From: indi2000 at pisem dot net
Operating system: Linux
PHP version: 4.3.3
PHP Bug Type: GD related
Bug description: image is broken if imagepng called from function

Description:
------------
Imagepng() works in sample.php but doesn't work if same code is called
inside function.

See reproduced code..

No errors, but it shows the broken image (like broken link to image or
image doesn't exists)


Reproduce code:
---------------
sample.php
---
header('Content-type: image/png');
$this->image = "images/1.png";
$this->im=imagecreatefrompng($this->image);
$this->w=imagecolorallocate($this->im, 0, 0, 0);
imagepng($this->im);
imagedestroy($this->im);
---

function show_image() {
header('Content-type: image/png');
$this->image = "images/1.png";
$this->im=imagecreatefrompng($this->image);
$this->w=imagecolorallocate($this->im, 0, 0, 0);
imagepng($this->im);
imagedestroy($this->im);
}



--
Edit bug report at [url]http://bugs.php.net/?id=25716&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=25716&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=25716&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=25716&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=25716&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=25716&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=25716&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=25716&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=25716&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=25716&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=25716&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=25716&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=25716&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=25716&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=25716&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=25716&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=25716&r=float[/url]