For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > May 2004 > Binary dump in browser









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Binary dump in browser
Bike Rider

2004-05-20, 2:31 pm

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. Sinan Unur

2004-05-20, 2:31 pm

google@webticker.com (Bike Rider) wrote in
news:870ce12a.0405200944.61b3668c@posting.google.com:

> 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.
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com