This commit was generated by cvs2svn to compensate for changes in r3921,
[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 $m->out($_) while (<FILE>);
19 close(FILE);
20 $m->abort;
21 </%init>