--- loncom/homework/randomlylabel.pm 2002/11/17 09:43:40 1.3 +++ loncom/homework/randomlylabel.pm 2003/01/23 18:26:10 1.5 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # randomlabel.png: composite together text and images into 1 image # -# $Id: randomlylabel.pm,v 1.3 2002/11/17 09:43:40 albertel Exp $ +# $Id: randomlylabel.pm,v 1.5 2003/01/23 18:26:10 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,7 +39,7 @@ use GD; sub get_image { my ($imgsrc,$set_trans)=@_; my $image; - if ($imgsrc !~ /\.(png|jpg|jpeg)$/) { + if ($imgsrc !~ /\.(png|jpg|jpeg)$/i) { my $conv_image = Image::Magick->new; my $current_figure = $conv_image->Read('filename'=>$imgsrc); $conv_image->Set('magick'=>'png'); @@ -64,6 +64,10 @@ sub handler { &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"}); + return OK; + } #binmode(STDOUT); my $black = $image->colorAllocate(0,0,0); for(my $i=0;$i<$ENV{"form.ICOUNT"};$i++) {