[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 28 Jun 2005 14:58:25 -0000
albertel Tue Jun 28 10:58:25 2005 EDT
Modified files:
/loncom/homework randomlabel.pm
Log:
- it was ISE ing on a divide by zero if width/height was unspecfied
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.77 loncom/homework/randomlabel.pm:1.78
--- loncom/homework/randomlabel.pm:1.77 Tue Jun 7 18:31:30 2005
+++ loncom/homework/randomlabel.pm Tue Jun 28 10:58:23 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.77 2005/06/07 22:31:30 foxr Exp $
+# $Id: randomlabel.pm,v 1.78 2005/06/28 14:58:23 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -206,15 +206,18 @@
# If the tag produced has sizes, they override ours.
# (for now anyway).
#
-
&Apache::lonxml::debug("Base sizes: $width_param x $height_param");
my ($plot_x, $plot_y) = &extract_tag_sizes($bgimg,
$width_param,
- $height_param );
+ $height_param);
&Apache::lonxml::debug("Extracted sizes: $plot_x x $plot_y");
- $label_xscale = $plot_x / $width_param;
- $label_yscale = $plot_y / $height_param;
+ if ($width_param) {
+ $label_xscale = $plot_x / $width_param;
+ }
+ if ($height_param) {
+ $label_yscale = $plot_y / $height_param;
+ }
&Apache::lonxml::debug("Scale factors: $label_xscale $label_yscale");
&Apache::lonxml::debug("Image: $bgimg");
@@ -272,8 +275,6 @@
$Apache::lonxml::debug = 0;
} else {
-
-
$result.=&make_eps_image($bgimg,$parstack,$safeeval,-2);
}
}