Hi all, I have PHP installed with the GD library and the extension seems to be functioning correctly. However, I am attempting to create a thumbnail image from a users's uploaded photo and am getting the error "Warning: Supplied argument is not a valid Image resource" when trying to call the ImageJPEG function. I have checked the GD installation, and JPEG support is enabled. I can't figure out why it isn't working as I've compared my code to other scripts and it appears as though I have it done correctly. Here is a sample of my code, maybe someone can help me. I've been searching for an answer to this all day with no success. I am trying to allow a user to upload a photo and then save the thumbnail to disk.
// find resized dimensions
$imageInfo = GetImageSize("./pictures/temp/$picture_name");
$width = $imageInfo[0];
$height = $imageInfo[1];
$newwidth = 100;
$resize_factor = $newwidth / $width;
$newheight = $resize_factor * $height;
// create thumbnail
if($photo_extension == "jpg") {
$origimg = ImageCreateFromJPEG("./pictures/temp/$picture_name");
$thumbimg = ImageCreate($newwidth, $newheight);
$im = ImageCopyResized($thumbimg, $origimg, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$newthumb = ImageJPEG($im,'',75);
copy($newthumb, "./pictures/$photo_thumb");
ImageDestroy($thumbimg);
ImageDestroy($origimg);
}