summaryrefslogtreecommitdiff
path: root/httemplate/view/image.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/view/image.cgi')
-rw-r--r--httemplate/view/image.cgi31
1 files changed, 31 insertions, 0 deletions
diff --git a/httemplate/view/image.cgi b/httemplate/view/image.cgi
new file mode 100644
index 0000000..153ec85
--- /dev/null
+++ b/httemplate/view/image.cgi
@@ -0,0 +1,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>