$Images{"SomeDB.Auction.image"} = "id_lot=?"; #### #!/usr/bin/perl do "image.cfg"; sub ERR { Apache->request()->status(404) and exit } (undef, $db, $table, $field, @param) = split "/", $ENV{PATH_INFO}; ERR() unless $db=~/^\w+$/ and $table=~/^\w+$/ and $field and @param; die "HACK! path: $ENV{PATH_INFO}" unless $where=$Images{"$db.$table.$field"}; die "HACK! param count: $ENV{PATH_INFO}" unless $where=~tr/?// == @param; $dbh = DBI->connect(@{$MySQL{$db}}, {RaiseError=>0, PrintError=>0}); ($field, @keys) = split /\./, $field; $image = $dbh->selectrow_array("SELECT $field FROM $table WHERE $where", undef, @param); $image = eval("$image" or "{}") if @keys; $image = $image->{$_} for @keys; ERR() unless $image; print CGI::header("image/gif"), $image;