#31229 [Opn->Bgs]: JPegs and GD Image creation displays garbage

From: Date: Tue, 21 Dec 2004 14:36:22 +0000
Subject: #31229 [Opn->Bgs]: JPegs and GD Image creation displays garbage
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70847@lists.php.net to get a copy of this message
ID: 31229 Updated by: iliaa@php.net Reported By: douglasrice at yahoo dot com -Status: Open +Status: Bogus Bug Type: Apache related Operating System: Windows XP Pro PHP Version: 4.3.10 New Comment: The output seems to be correct for a PNG image, it seems that the header identifying the content is being removed by apache or ignored by your browser. Previous Comments: ------------------------------------------------------------------------ [2004-12-21 13:40:16] douglasrice at yahoo dot com Description: ------------ Apologies if this isn't a bug. Suspect it is an Apache problem. I have Apache 1.3.33 and PHP 4.3.10 running on Windows XP Pro with Service Pack 2 installed. I have retrieved a jpeg file into a php variable. When trying to display the image i.e. echo("$pic"), the data of the jpeg rather than the jpeg itself is printed out. Have used the sample code for "Creating a new GD image stream and outputting an image." in php manual and this does the same thing...display the image "data" rather than the image. I have included header info ie content type = image/png or image/jpeg to with no luck. I suspect it is a setting in Apache, but have trawled the internet and found many people with the same problem, but no-one has an answer.....can you help? Reproduce code: --------------- <?php header("Content-type: image/png"); $im = @imagecreate(100, 50) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 255, 255); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, "A Simple Text String", $text_color); imagepng($im); imagedestroy($im); ?> Expected result: ---------------- An image is drawn to screen Actual result: -------------- The following is displayed to screen... ‰PNG  IHDRd2ûìýPLTEÿÿÿé[‘˝£eIDATxœc fxÄÀÃ`Ç ÀçÀÁÀÀÒÄ   [vKÇɁ§’ ì ‡Â\6p¦)ð¸u.``iP o9ÀÙ¦Á©Ty܍¯€ã¥€ŒŠ¬ÈX&Z¸u Y¿´ÈŠIEND®B`‚ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31229&edit=1

« previous php.bugs (#70847) next »