in reply to Serving images with perl
You have to know two things:
Then it's all a matter of sending the correct HTTP header, and then simply printing the image.
use CGI qw(:standard); my $mime_type = 'image/jpeg'; my $size = length($data); # Assuming $data contains your image print header( -type => $mime_type, -Content_Length => $size, ); print $data;
Now, how you get the mime type and the image is up to you, it could be from a database or from a file on disk.
|
---|