[LON-CAPA-cvs] cvs: loncom /homework imageresponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 01 Aug 2003 15:50:43 -0000
albertel Fri Aug 1 11:50:43 2003 EDT
Modified files:
/loncom/homework imageresponse.pm
Log:
- using the get_image in randomlylabel.pm
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.33 loncom/homework/imageresponse.pm:1.34
--- loncom/homework/imageresponse.pm:1.33 Fri Aug 1 10:22:07 2003
+++ loncom/homework/imageresponse.pm Fri Aug 1 11:50:43 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# image click response style
#
-# $Id: imageresponse.pm,v 1.33 2003/08/01 14:22:07 ng Exp $
+# $Id: imageresponse.pm,v 1.34 2003/08/01 15:50:43 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,6 +31,7 @@
#currently
package Apache::imageresponse;
+use Apache::randomlylabel;
use strict;
use Image::Magick;
use GD;
@@ -314,27 +315,6 @@
return $result;
}
-sub get_image {
- my ($imgsrc,$set_trans)=@_;
- my $image;
- 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');
- my @blobs=$conv_image->ImageToBlob();
- undef $conv_image;
- $image = GD::Image->new($blobs[0]);
- } else {
- GD::Image->trueColor(1);
- $image = GD::Image->new($imgsrc);
- }
- if ($set_trans && defined($image)) {
- my $white=$image->colorExact(255,255,255);
- if ($white != -1) { $image->transparent($white); }
- }
- return $image;
-}
-
sub end_image {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
@@ -348,7 +328,7 @@
my $y=$ENV{"form.HWVAL_$id:$temp.y"};
if (defined ($x) && defined ($y)) {
&Apache::lonxml::debug("x and y defined as $x,$y");
- my $currentImage = &get_image('/home/httpd/html'.$image,1);
+ my $currentImage = &Apache::randomlylabel::get_image('/home/httpd/html'.$image,1);
if (! defined($currentImage)) {
&Apache::lonnet::logthis('Unable to create image object for '.$image);
return '';