Fedora Linux Support Community & Resources Center
  #1  
Old 11th February 2010, 09:12 PM
Indian's Avatar
Indian Offline
Registered User
 
Join Date: Jun 2009
Location: Pt
Posts: 157
linuxfedorafirefox
Cool Image handling error on Apache

I have this code on a php script

PHP Code:
$im = @imagecreate(11020)
    or die(
"Cannot Initialize new GD image stream");
$background_color imagecolorallocate($im000);
$text_color imagecolorallocate($im2331491);
imagestring($im155,  "A Simple Text String"$text_color);
imagepng($im);
imagedestroy($im); 
Apache shows only bunch of garbage like

Quote:
�PNG  ��� IHDR���n������V,����PLTE����[an����fIDAT�c`�`fx���`Ǡ����41����˖ݒ�q�@੤; {á0� �i


Can anyone help me on this, i don't know why this happens
Thank you
__________________
Moving on Net Side
Reply With Quote
  #2  
Old 12th February 2010, 12:47 PM
Jamwa Offline
Registered User
 
Join Date: Jan 2008
Location: Nairobi Kenya
Posts: 540
linuxfedorafirefox
From the place where you copied the code, I see that they have included this line:

Code:
header("Content-type: image/png");
which you have omitted in your code.

Omitting that line also gives me the same results as you have.
Reply With Quote
  #3  
Old 12th February 2010, 05:59 PM
BandC's Avatar
BandC Offline
Registered User
 
Join Date: Nov 2004
Posts: 1,105
windows_xp_2003firefox
To explain further, including the header command tells your web server to specify to the client browser that the content you are sending is a PNG image and not plain text. So the browser renders an image instead of just dumping the text on the screen.
Reply With Quote
  #4  
Old 12th February 2010, 07:24 PM
Indian's Avatar
Indian Offline
Registered User
 
Join Date: Jun 2009
Location: Pt
Posts: 157
linuxfedorafirefox
Thanks i gues it was that
__________________
Moving on Net Side
Reply With Quote
  #5  
Old 20th February 2010, 12:15 AM
Vector's Avatar
Vector Offline
Banned
 
Join Date: Jul 2006
Location: Transgression
Age: 32
Posts: 1,183
linuxfedorafirefox
You will also get that if you have any extra spaces anywhere in your script. For example, any 'echo' or 'print' that you forgot to remove, or any whitespace before the opening php tag, or after the closing php tag. Those will all do it too, so be wary of them.
Reply With Quote
Reply

Tags
apache, error, handling, image

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"No application is registered as handling this file" error Kwanzee Using Fedora 9 11th December 2008 01:51 AM
Bash script error handling techmatt Programming & Packaging 6 10th December 2006 12:33 PM


Current GMT-time: 05:56 (Sunday, 19-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat