php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25716 image is broken if imagepng called from function
Submitted: 2003-10-01 12:19 UTC Modified: 2003-10-01 17:09 UTC
From: indi2000 at pisem dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.3 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: indi2000 at pisem dot net
New email:
PHP Version: OS:

 

 [2003-10-01 12:19 UTC] indi2000 at pisem dot net
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);  
}



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-01 17:09 UTC] elmicha@php.net
Works fine here. Did you forget to call the function? Does your code print something (e.g. whitespace) before you call the function? Does it have whitespace before the "<?php", perhaps in an include file?

If you want to reopen this bug, please provide a short, but _complete_ example script.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 17:01:26 2025 UTC