Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Error displaying PNGs

by pfaut (Priest)
on Mar 15, 2003 at 21:11 UTC ( #243349=note: print w/replies, xml ) Need Help??


in reply to Error displaying PNGs

You need to output HTTP headers indicating a proper Content-Type for a PNG image. Before the binmode, you want something like

print "Content-type: image/x-png\n\n";
--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
Wrong MIME type (was: Error displaying PNGs)
by Aristotle (Chancellor) on Mar 16, 2003 at 01:09 UTC
    The right MIME type is image/png though. All else will result in undefined behaviour, even if some browsers will work.

    Makeshifts last the longest.

      Thanks, Aristotle. I've long since lost my pointer to a list of valid content types. I posted what I last remembered seeing which was likely a long time ago before PNG files were popular.

      --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://243349]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2021-04-11 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?