[LON-CAPA-cvs] cvs: loncom /homework randomlylabel.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 26 Feb 2003 18:49:58 -0000


albertel		Wed Feb 26 13:49:58 2003 EDT

  Modified files:              
    /loncom/homework	randomlylabel.pm 
  Log:
  - fixes issues with trying to pallatize JPEGs
  - don't delete image ref unless we successfully load the image
  
  
Index: loncom/homework/randomlylabel.pm
diff -u loncom/homework/randomlylabel.pm:1.5 loncom/homework/randomlylabel.pm:1.6
--- loncom/homework/randomlylabel.pm:1.5	Thu Jan 23 13:26:10 2003
+++ loncom/homework/randomlylabel.pm	Wed Feb 26 13:49:58 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # randomlabel.png: composite together text and images into 1 image
 #
-# $Id: randomlylabel.pm,v 1.5 2003/01/23 18:26:10 www Exp $
+# $Id: randomlylabel.pm,v 1.6 2003/02/26 18:49:58 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -47,6 +47,7 @@
 	undef $conv_image;
 	$image = GD::Image->new($blobs[0]);
     } else {
+	GD::Image->trueColor(1);
 	$image = GD::Image->new($imgsrc);
     }
     if ($set_trans) {
@@ -62,10 +63,10 @@
     my (undef,$token) = split(/=/,$ENV{'QUERY_STRING'});
     &Apache::loncommon::get_unprocessed_cgi(
                &Apache::lonnet::unescape($ENV{'imagerequest.'.$token}));
-    &Apache::lonnet::delenv('imagerequest\.'.$token);
     my $image=&get_image($ENV{"form.BGIMG"},0);
     if (! defined($image)) {
-        &Apache::lonnet::logthis('Unable to create image object for '.$ENV{"form.BGIMG"});
+        &Apache::lonnet::logthis('Unable to create image object for '.
+				 $ENV{"form.BGIMG"});
         return OK;
     }
     #binmode(STDOUT);
@@ -81,6 +82,7 @@
 		       $ENV{"form.LB$i"},$black);
     }
     $r->print($image->png);
+    &Apache::lonnet::delenv('imagerequest\.'.$token);
     return OK;
 }