in reply to CGI-Perl:: Location for saving the GD output
You can
in the page referencing the image, and have it served thusly:<img src="/cgi-bin/image.pl?img=$tag.jpg">
#!/usr/bin/perl -T use CGI; use strict; my $q = new CGI; if($q->param('img') =~ /^([\w\.\-]+)$/) { # untaint my $file = $1; if(-f "/tmp/$file") { if(open(I,'<',"/tmp/$file")) { print $q->header(-content_type => "image/jpeg"); print while <I>; close I; exit; } } } print $q->header(-status => '404 Not found'); print "<h1>Not found.</h1>\n";
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI-Perl:: Location for saving the GD output
by cool (Scribe) on Sep 10, 2006 at 17:40 UTC | |
by shmem (Chancellor) on Sep 10, 2006 at 22:19 UTC | |
by cool (Scribe) on Sep 11, 2006 at 06:38 UTC | |
by shmem (Chancellor) on Sep 11, 2006 at 07:53 UTC | |
by cool (Scribe) on Sep 11, 2006 at 09:12 UTC | |
|