http://www.perlmonks.org?node_id=282545


in reply to Re: Re: Serving Images from Databases
in thread Serving Images from Databases

Ovid,

I tried the code that you posted a while ago. I used it on a Win2k server and never had any problem. I switched onto Unix iPlanet and the code does not work anymore. The last line :

print header(-type => 'image/gif', -Content_length => length $file), $file;

causes the script to hang and never return... I am not too familiar with iPlanet ... can it be a problem with the web server ?

Do you have any idea why ?

... use CGI qw(header path_info); my $file = getNoImage($SHOP); print header(-type => 'image/gif', -Content_length => length $file), $ +file; sub getNoImage { my $SHOP = shift || croak ("ProcessAction : Missing Shop data"); my ($chunk, $image); open IMAGEFILE, "$SHOP->{-TEMPLATE_PATH}/img/NoImage.gif" or die " +Cannot open $SHOP->{-TEMPLATE_PATH}/img/NoImage.gif: $!\n"; binmode IMAGEFILE; while (read(IMAGEFILE, $chunk, 1024)) { $image .= $chunk; } close IMAGEFILE; return $image; }