Re: Problem with Image_Transform

From: Date: Thu, 10 Jun 2004 13:20:26 +0000
Subject: Re: Problem with Image_Transform
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13073@lists.php.net to get a copy of this message
On 10 Jun 2004 at 14:20, Ralf Eggert wrote: > I have a little problem with Image_Transform. When I use the save() > function I get a warning message: > > Warning: imagedestroy(): 95 is not a valid Image resource in > e:\_pear\Image\Transform\Driver\GD.php on line 271 > > The error occurs in the free() function which is called by the save() > function. > > 265 function free() > 266 { > 267 $this->imageHandle = $this->old_image; > 268 $this->resized = false; > 269 ImageDestroy($this->old_image); > 270 if ($this->imageHandle){ > 271 ImageDestroy($this->imageHandle); > 272 } > 273 } > > So the error occurs when ImageDestroy($this->imageHandle) is processed. > When I make a var_dump($this->imageHandle) before and after line 269 I > get the following output: > > resource(95) of type (gd) > resource(95) of type (Unknown) > > I use Image_Transform 0.8 with PHP 4.3.7 and GD 2.0.23 on Windows XP. > > Can anybody help? Yes, you are not actually copying that resource. You are just copying the "resource pointer", sort of. And when you destroy old-image you also destroy the resource to which imageHandle points. Simply don't do that :-)) You might try unsetting $this->old_image manually and make imageHandle only a reference to it: $this->imageHandle = & $this->old_image; (note the ampersand). However, I don't know if this works and if you really need it. Why would you wanna detroy it twice?!? Stefan

« previous php.pear.general (#13073) next »