Question about Succesive imagedestroy

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Question about Succesive imagedestroy

Post 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.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Question about Succesive imagedestroy

Post 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(),
Post Reply