Page 1 of 1

Question about Succesive imagedestroy

Posted: Wed Jan 16, 2008 4:02 am
by Rovas
I have a script that creates a new image by coloring a version of the original obtained by grayscaling it.
An error appears: WARNING: imagedestroy(): 31 is not a valid Image resource color_old.php on line 15. Line 15 is the last line in the code snippet

Code: Select all

 
/*standard code for creating  image using the dimensions of the old one*/
$new=colorOld($old, $color); //colorOld uses the old technique for coloring images
imagejpg($new, 100);
imagedestroy($old);
imagedestroy($new);
 

If I turn off the error message the obtained image is displayed correctly.

Re: Question about Succesive imagedestroy

Posted: Wed Jan 16, 2008 6:20 am
by Kieran Huggins
colourOld isn't a PHP function - maybe it' not returning a valid image handler? Neither is imagejpg() for that matter, and it's missing the "filename" argument of it's valid brother: imagejpeg(),