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?
Solution: Ok, I think it had something to do with an incorrect $path variable, it seems to be working fine now.