in reply to Serve image from file
Securing those environment variables is not needed, since you don't spawn any kids.
You're using the wrong MIME type for "JPEG" images. It's should be image/jpeg.
die is not very appropriate for CGI scripts.
exit is not needed.
sysread is probably more appropriate, but I find $/ = \2048 and $/ = \$buffer_size neat:
local $/ = \2048; open(my $fh, '<', $path) or die "Failed to open $path: $!"; binmode($fh); binmode(STDOUT); print while <$fh>;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Serve image from file
by ruzam (Curate) on Apr 28, 2006 at 22:47 UTC |