diff options
| author | fukachan <fukachan> | 2008-09-10 03:49:05 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2008-09-10 03:49:05 +0000 |
| commit | 0c9d0892c7e8cbca0749811266edac5e96cafc92 (patch) | |
| tree | b0d4fb192fc48c947cadd1b1ed05595c1bd47a47 | |
| parent | 366054d9369a7f3f2c663ef047d73d4d7493cb45 (diff) | |
| download | fml8-0c9d0892c7e8cbca0749811266edac5e96cafc92.tar.gz fml8-0c9d0892c7e8cbca0749811266edac5e96cafc92.tar.bz2 fml8-0c9d0892c7e8cbca0749811266edac5e96cafc92.zip | |
(1) check if the banner image format generator works or not
(2) if not, use ascii generator.
| -rw-r--r-- | fml/lib/FML/CGI/Skin/Anonymous.pm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fml/lib/FML/CGI/Skin/Anonymous.pm b/fml/lib/FML/CGI/Skin/Anonymous.pm index b823d210..92682c9b 100644 --- a/fml/lib/FML/CGI/Skin/Anonymous.pm +++ b/fml/lib/FML/CGI/Skin/Anonymous.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML$ +# $FML: Anonymous.pm,v 1.1 2008/09/09 08:48:59 fukachan Exp $ # package FML::CGI::Skin::Anonymous; @@ -401,11 +401,17 @@ sub _anonymous_cgi_print_magic_string my $session_id = $db->get_session_id(); use FML::String::Banner; - my $banner = new FML::String::Banner; + my $banner = new FML::String::Banner $curproc; $banner->set_string($string); + + # firstly, check if image generator works. + my $png = $banner->as_png(); + unless (defined $png) { $is_mode = "ascii";}; + + # go! go! go! if ($is_mode eq "ascii") { my $ascii = $banner->as_ascii(); - printf("\n<pre>[%s]\n\n%s\n</pre>\n", $name_magic, $ascii); + printf("\n<p>[%s]\n<pre>\n%s\n</pre>\n", $name_magic, $ascii); } elsif ($is_mode eq "png") { my $html_tmp_dir = $config->get('html_tmp_dir'); @@ -421,7 +427,6 @@ sub _anonymous_cgi_print_magic_string my $wh = new FileHandle "> $image_file"; if (defined $wh) { $wh->binmode(); - my $png = $banner->as_png(); $wh->print($png); $wh->close(); } |
