php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27925 GD image resource cannot be stored in class property
Submitted: 2004-04-08 20:04 UTC Modified: 2004-04-09 12:53 UTC
From: kris dot hofmans at pandora dot be Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0RC1 OS: Linux 2.6
Private report: No CVE-ID: None
 [2004-04-08 20:04 UTC] kris dot hofmans at pandora dot be
Description:
------------
class jpegImage extends Image { 
	public function __construct($filename){ $this->image = imagecreatefromjpeg($filename); }
}

After storing the image in $this->image it cannot be used in other GD functions outside of the construct, it doesn't get recognized as a resource

Reproduce code:
---------------
class Image { 
	private $image = null;
	public function __construct($filename){ $this->image = imagecreate(100,100); }

	public function __destruct(){ imagedestroy($this->image); }

}

Expected result:
----------------
I'd expect the GD Image that can be used throught my class until it is __destruct'd

Actual result:
--------------
supplied argument is not a valid Image resource

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-09 12:53 UTC] sniper@php.net
Works fine with latest CVS snapshot. (http://snaps.php.net)

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 26 21:00:02 2025 UTC