Is something wrong with this php GD code?
Posted
by ThinkingInBits
on Stack Overflow
See other posts from Stack Overflow
or by ThinkingInBits
Published on 2010-05-17T18:25:55Z
Indexed on
2010/05/17
18:30 UTC
Read the original article
Hit count: 225
if ($img = @imagecreatefromjpeg('./images/upload/13/1.JPG')) {
imagejpeg($img, $path, 100);
imagedestroy($img);
} else {
die ("image was not created or saved");
}
I'm getting the message:
Warning: imagejpeg(): 8 is not a valid Image resource in C:\xampp\htdocs\invivid\libraries\photograph_classes.php on line 276
Warning: imagedestroy(): 8 is not a valid Image resource in C:\xampp\htdocs\invivid\libraries\photograph_classes.php on line 277
The image is being created initially, we know this from the if statement, but why doesn't imagejpeg or imagedestroy work properly?
© Stack Overflow or respective owner