Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying images with CGI

Status
Not open for further replies.

DaveGill

Technical User
Jun 27, 2001
10
GB
Hi,
I'm quite new to CGI programming but what I want to do is display an image using a CGI application. I've written an app that reads a TIF file, converts it to PNG then writes it to stdout. If I redirect the output to a file I can then view the file but if I try and display it in a html pages ising <img src=&quot;test.cgi&quot;> nothing is displayed. Is there something I'm missing?

Thanks
David
 
Are you printing the appropriate content-type header first?
Something like this:
Code:
print &quot;Content-type: image/png\n\n&quot;;
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
I've tried that but it still doesn't work.

David
 
Are you writing the output in binmode? Image format files need to be processed as binaries to avoid the end-of-line termination string being added by the web server.

HTH,
Barbie. Leader of Birmingham Perl Mongers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top