blob: 2e428c157c87a43d7e2320b9bce4a9fc5aac2555 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<%init>
# This autohandler will spit out RT's images if the user hasn't
# properly configured their webserver to stop RT from passing
# images through the mason handler.
my $file = $m->base_comp->source_file;
my $type = "application/octet-stream";
if ($file =~ /\.(gif|png|jpe?g)$/i) {
$type = "image/$1";
$type =~ s/jpg/jpeg/gi;
}
die unless (-f $file && -r $file);
$r->content_type($type);
open (FILE, "<$file") || die;
{
local $/ = \16384;
$m->out($_) while (<FILE>);
close(FILE);
}
$m->abort;
</%init>
|