Binary dump in browser

B

Bike Rider

Hey folks!
I am having a problem with a perl script that is printing binary into
the browser... Credit being due where credit is being due first...
<PLUG ALT="suckup">
I bought Martien Verbuggen's book "Graphics Programming with Perl" and
it is GREAT! I know Martien is in here from time to time and first off
MANY thanks for a great piece of work (Buy it now!)
</PLUG>

Here's the code in question....

$im = Image::Magick->new();
$im->Read($uploadedfile);
binmode STDOUT;
print $cgi->header('image/jpeg');
$im->Write('jpg:-');

Instead of actualy showing the image it does a binary dump in the
browser.

I have NO experience in pushing out binary this way and thought I'd
see if anyone has seen this before. Yes yes I know it is probably
something extraordinarily simple but I have RTFM'd and RTFGSR (Read
The ..ahem Fine Google Search Results) extensively and no luck.

Many thanks in advance!
Julian
 
A

A. Sinan Unur

(e-mail address removed) (Bike Rider) wrote in
Hey folks!
I am having a problem with a perl script that is printing binary into
the browser... Credit being due where credit is being due first...
<PLUG ALT="suckup">
I bought Martien Verbuggen's book "Graphics Programming with Perl" and
it is GREAT! I know Martien is in here from time to time and first off
MANY thanks for a great piece of work (Buy it now!)
</PLUG>

Here's the code in question....

$im = Image::Magick->new();
$im->Read($uploadedfile);
binmode STDOUT;
print $cgi->header('image/jpeg');
$im->Write('jpg:-');

You should probably print the header _before_ switching STDOUT to
binmode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top