#31229 [NEW]: JPegs and GD Image creation displays garbage
| From: | douglasrice at yahoo dot com | Date: | Tue, 21 Dec 2004 12:40:17 +0000 |
| Subject: | #31229 [NEW]: JPegs and GD Image creation displays garbage | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70829@lists.php.net to get a copy of this message | ||
From: douglasrice at yahoo dot com
Operating system: Windows XP Pro
PHP version: 4.3.10
PHP Bug Type: Apache related
Bug description: JPegs and GD Image creation displays garbage
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ÿÿÿé[Ë£eIDATxc
fxÄÀÃ`Ç ÀçÀÁÀÀÒÄ
[vKÇɧ ì Â\6p¦)ð¸u.``iP o9ÀÙ¦Á©Tyܯ㥬ÈX&Z¸u
Y¿´ÈIEND®B`
--
Edit bug report at http://bugs.php.net/?id=31229&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31229&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31229&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31229&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31229&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31229&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31229&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31229&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31229&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31229&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31229&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31229&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31229&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31229&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31229&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31229&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31229&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31229&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31229&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31229&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31229&r=mysqlcfg