Thank you for all help I have just figured out that there is other
variable prob. See pointer "------->":
<?php
$nw=100; //The Width Of The Thumbnails
//$rw=400;
$ipath = "./pics"; //Path To Place Where Images Are Uploaded.
$tpath = "./thumbs";//Path To Place Where Thumbnails Are Uploaded
function LoadJpeg ($imgname) {
$im = @imagecreatefromjpeg ($imgname); /* Attempt to open */
if (!$im) { /* See if it failed */
$im = imagecreate (150, 30); /* Create a blank image */
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
$dimensions = getimagesize($file);
$thname = "$tpath/$file_name";
//$rname = "$ipath/$file_name";
$w=$dimensions[0];
$h=$dimensions[1];
$c=$nw/$w;
----------> //$c2=$rw/w; <----------------
$nh=$h*$c; //The Height Of The Thumbnails
//$rh=$h*$c2; //The Height Of The Large Pictures
$img = LoadJpeg($file);
//$img2 = LoadJpeg($file);
$thumb = imagecreatetruecolor($nw,$nh);
//$large = imagecreatetruecolor($rw,$rh);
imagecopyresampled($thumb,$img,0,0,0,0,$nw,$nh,$w,$h);
// imagecopyresampled($large,$img2,0,0,0,0,$rw,$rh,$w,$h);
imagejpeg($thumb,$thname,95);
// imagejpeg($large,$rname,95);
imagedestroy($img2);
?>
On 6 Oct 2003 at 8:09, Jason Wong wrote:
> On Monday 06 October 2003 00:32, Yury B. wrote:
> > Hi I need to upload two resized images out from one jpg image. I use
> > following code to do it:
>
> [snip]
>
>
> > This code is working perfectly but produces only one uploaded and
> > resized image (I comented out the lines that I add for second image)
> > If I take out comments from the code on the second image - this
> > script doesn't work - it produces two files on the server but only
> > one of them is working the other one shows error of wrong hedding.
> > How should I upload two resized files? I know it's possible but how
> > can I fit everything in one portion of code?
>
> Check the values of all your variables -- in particular $rw, as it doesn't
> seem to be initialised.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> One thing about the past.
> It's likely to last.
> -- Ogden Nash
> */
>
<>< <>< <>< <>< God is our provider ><> ><> ><> ><>
http://www.body-builders.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php