in reply to MySQL: Image in a blob
<!-- image.html --> <img src="/cgi-bin/view_image.pl?image=123">
Note, this code is untested, but I do something similar with images, using Mason under mod_perl#!/usr/bin/perl # view_image.pl use strict; use warnings; use DBI; use CGI; my $q = CGI->new(); my $dbh = DBI->connect(....); # db setup stuff here my $sth = $dbh->prepare("SELECT image_blob FROM images WHERE image=?") +; my $result = $sth->execute($q->param('image')); if ($result && $result->rows()) { my $image_blob = $result->fetchrow_array(); print $q->header( -type => 'image/jpeg' ); print $image_blob; exit; }
|
|---|