View Single Post
Old 9th September 2010, 13:31
Mark_NL Mark_NL is offline
Senior Member
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts

So you're trying to show an image in your browser with a perl script ..

remember that you're not allowed to send a single byte extra besides the image data + it's mime type .. so the browser knows how to interpretate it..

Read an image (png and output as jpeg):
use strict;
use CGI;
use Image::Magick;

$oCGI = new CGI;

print $oCGI->header( -type => "image/png", -expires => "now" );
my $oImageMagick = new Image::Magick( format => "png" );
$oImageMagick->Read( filename => "/some/imagefile.png" );
binmode STDOUT;
$oImageMagick->Write( "png:-" );
It's from the top of my head, so could not work right away
Reply With Quote