php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31229 JPegs and GD Image creation displays garbage
Submitted: 2004-12-21 13:40 UTC Modified: 2004-12-21 17:06 UTC
From: douglasrice at yahoo dot com Assigned:
Status: Not a bug Package: Apache related
PHP Version: 4.3.10 OS: Windows XP Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: douglasrice at yahoo dot com
New email:
PHP Version: OS:

 

 [2004-12-21 13:40 UTC] 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`? 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-21 15:36 UTC] iliaa@php.net
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.
 [2004-12-21 17:06 UTC] douglasrice at yahoo dot com
Thanks for your quick response.

The problem is that I don't know what to do from here...
I thought that the PHP would be working fine and that it is an Apache problem.  However, do you know what can cause this?  Any faq reference would be great.

Many Thanks for you help.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 15:01:33 2024 UTC