5 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
7 my $conf = new FS::Conf;
10 if ( $cgi->param('type') eq 'png' ) {
12 } elsif ( $cgi->param('type') eq 'eps' ) {
15 die "unknown logo type ". $cgi->param('type');
19 if ( $cgi->param('preview_session') =~ /^(\w+)$/ ) {
22 my $curuser = $FS::CurrentUser::CurrentUser;
23 $data = decode_base64( $curuser->option("logo_preview$session") );
25 } elsif ( $cgi->param('name') =~ /^([^\.\/]*)$/ ) {
27 my $templatename = $1;
28 if ( $templatename && $conf->exists("logo_$templatename.$type") ) {
29 $templatename = "_$templatename";
34 if ( $type eq 'png' ) {
35 $data = $conf->config_binary("logo$templatename.png");
36 } elsif ( $type eq 'eps' ) {
37 #convert EPS to a png... punting on that for now
41 die "neither a valid name nor a valid preview_session specified";
44 http_header('Content-Type' => 'image/png' );