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