in reply to Serving images with perl
My two cents,use CGI; my $img = CGI->new->param('name'); my ($type) = (lc($img) =~ m/([^\.]+)$/s); my %switch = qw/jpg jpeg tif tiff/; $type = $switch{$type} if exists $switch{$type}; print "Content-type: image/$type\n\n"; open(IMG,"</path/to/files/$img"); binmode(IMG); binmode(STDOUT); print while <IMG>; close(IMG);
--
By a scallop's forelocks!
|
---|