summaryrefslogtreecommitdiff
path: root/httemplate/view/image.cgi
blob: 153ec858ec9839664e8a21d64e42a57ffd67d8c8 (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
25
26
27
28
29
30
31
<% $data %>\
<%init>

#die "access denied"
#  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $conf = new FS::Conf;

my $type;
if ( $cgi->param('type') eq 'png' ) {
  $type = 'png';
} elsif ( $cgi->param('type') eq 'eps' ) {
  $type = 'eps';
} else {
  die "unknown image type ". $cgi->param('type');
}

my $data;
if ( $cgi->param('prefname') =~ /^(\w+)$/ ) {

  my $prefname = $1;
  my $curuser = $FS::CurrentUser::CurrentUser;
  $data = decode_base64( $curuser->option("$prefname") );

} else {
  die "no preview_session specified";
}

http_header('Content-Type' => 'image/png' );

</%init>