[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /interface printout.pl

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 24 Apr 2006 21:31:07 -0000


albertel		Mon Apr 24 17:31:07 2006 EDT

  Modified files:              (Branch: version_2_1_X)
    /loncom/interface	printout.pl 
  Log:
  - backport 1.98
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.94 loncom/interface/printout.pl:1.94.2.1
--- loncom/interface/printout.pl:1.94	Thu Dec 15 13:41:21 2005
+++ loncom/interface/printout.pl	Mon Apr 24 17:31:03 2006
@@ -242,15 +242,36 @@
 	      $done_conversion{$not_eps}=1;
 	      # print "Converting $not_eps -> $eps_f"; # Debugging
 	      system("convert $not_eps $eps_f");
-              #check is eps exist in prtspool
-              if(not -e $eps_f) {
+              # check is eps exist in prtspool
+              if (not -e $eps_f) {
+		  # converting an animated gif creates either:
+                  # anim.gif.eps.0
+                  # or
+                  # anim.gif-0.eps
 		  for (my $i=0;$i<10000;$i++) {
 		      if (-e $eps_f.'.'.$i) {
-			  rename $eps_f.'.'.$i, $eps_f;
+			  rename($eps_f.'.'.$i, $eps_f);
 			  last;
 		      }
+		      my $anim_eps = $eps_f;
+		      $anim_eps =~ s/(\.[^.]*)\.eps$/$1-$i\.eps/i;
+		      if (-e $anim_eps) {
+			  rename($anim_eps, $eps_f);
+			  last;
+		      }
+		  }
+	      }
+	      # imagemagick 6.2.0-6.2.7 fails to properly handle
+              # convert anim.gif anim.gif.eps
+              # it creates anim.eps instead. 
+              if (not -e $eps_f) {
+		  my $eps_f2 = $eps_f;
+		  $eps_f2 =~ s/\.[^.]*\.eps$/\.eps/i;
+		  if(-e $eps_f2) {
+		      rename($eps_f2,$eps_f);
 		  }
-	      }  
+	      }
+
 	  }
       }
       if ($advanced_role) {