im creating a new image in this function, but you get the idea..
How do you resize pictures once they're in a certain directory? I have the script to upload a picture, that's working fine. I just need some help with resizing it. Can someone help?
Thanks!
function generateThumb($ID)
{
$source_image = GALLERY_ROOT . "images/". $ID . ".jpg";
$dest_image = GALLERY_ROOT . "thumbnails/" . $ID . ".jpg";
$source_id = imageCreateFromJPEG($source_image);
$picsize = getimagesize($source_image);
$source_x = $picsize[0];
$source_y = $picsize[1];
$dest_x = THUMB_X;
$dest_y = THUMB_Y;
$target_id = imagecreatetruecolor($dest_x,$dest_y);
$target_pic = imagecopyresampled($target_id,$source_id, 0,0,0,0,$dest_x,$dest_y,$source_x,$source_y);
return imagejpeg($target_id,$dest_image);
}
Dan
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php