You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/10/28 03:23:17 UTC

svn commit: r329023 - /spamassassin/trunk/masses/rule-qa/rule-hits-over-time

Author: jm
Date: Thu Oct 27 18:23:15 2005
New Revision: 329023

URL: http://svn.apache.org/viewcvs?rev=329023&view=rev
Log:
avoid use of ImageMagick 'convert' command -- use pure GD only

Modified:
    spamassassin/trunk/masses/rule-qa/rule-hits-over-time

Modified: spamassassin/trunk/masses/rule-qa/rule-hits-over-time
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/rule-hits-over-time?rev=329023&r1=329022&r2=329023&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/rule-hits-over-time (original)
+++ spamassassin/trunk/masses/rule-qa/rule-hits-over-time Thu Oct 27 18:23:15 2005
@@ -150,19 +150,31 @@
   plot_gd();
 }
 
+my $format = $gd->export_format;
+
 if (!$graph_files_individually) {
-  system ("convert -append file01.gif file02.gif both.gif");
-}
+  my $both = new GD::Image($graph_x, $graph_y * 2);
+  my $file01 = new GD::Image("file01.$format") or die;
+  my $file02 = new GD::Image("file02.$format") or die;
+  $both->copy($file01, 0, 0, 0, 0, $graph_x-1, $graph_y-1);
+  $both->copy($file02, 0, $graph_y, 0, 0, $graph_x-1, $graph_y-1);
 
-if ($opt_cgi) {
-  use CGI qw(:standard);
-  my $format = $gd->export_format;
-  print header("image/$format");
-  binmode STDOUT;
-  open (IN, "<both.gif") or die "no both.gif";
-  binmode IN;
-  while (<IN>) { print STDOUT; }
-  close IN;
+  if ($opt_cgi) {
+    use CGI qw(:standard);
+    my $format = $gd->export_format;
+    print header("image/$format"); binmode STDOUT;
+    print STDOUT $both->$format();
+  }
+  else {
+    open(IMG, ">both.$format") or die $!; binmode IMG;
+    print IMG $gd->gd()->$format();
+    close IMG;
+  }
+
+  $both->png();
+}
+else {
+  warn "TODO: cannot produce combined images in multi-file mode";
 }
 
 if ($opt_cgi) {