[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Thu, 11 Jul 2002 18:20:00 -0000
sakharuk Thu Jul 11 14:20:00 2002 EDT
Modified files:
/loncom/xml londefdef.pm
Log:
Corrected with Image::Magick.
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.69 loncom/xml/londefdef.pm:1.70
--- loncom/xml/londefdef.pm:1.69 Thu Jul 11 10:40:14 2002
+++ loncom/xml/londefdef.pm Thu Jul 11 14:20:00 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.69 2002/07/11 14:40:14 sakharuk Exp $
+# $Id: londefdef.pm,v 1.70 2002/07/11 18:20:00 sakharuk Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -48,6 +48,7 @@
use strict;
use Apache::lonxml;
use Apache::File();
+use Image::Magick;
BEGIN {
@@ -1310,7 +1311,7 @@
chop $output;
$output .= ' \\\\ ';
}
- $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$output.$Apache::londefdef::table[-1]{'hinc'}.'\end{tabular}';
+ $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$output.$Apache::londefdef::table[-1]{'hinc'}.'\end{tabular}\vskip 0 mm ';
if ($#Apache::londefdef::table > 0) {
$inmemory = $Apache::londefdef::table[-1]{'output'};
pop @Apache::londefdef::table;
@@ -1428,18 +1429,11 @@
} elsif ($target eq 'tex') {
my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval);
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
- if ($src=~m/\.(gif|GIF)$/) {
- my $gif_file = Apache::File->new($src);
- binmode ($gif_file);
- my ($buff,$imagesize);
- read ($gif_file,$buff,6);
- read ($gif_file,$imagesize,4);
- my ($xlsb,$xmsb,$ylsb,$ymsb) = split(//,$imagesize);
- my $image_width=ord($xlsb)+ord($xmsb)*256;
- my $image_height=ord($ylsb)+ord($ymsb)*256;
- $width_param = $image_width * $scaling; #default value of the picture's width
- $height_param = $image_height * $scaling; #default value of the picture's height
- }
+ my $image = Image::Magick->new;
+ my $current_figure = $image->Read($src);
+ $width_param = $image->Get('width') * $scaling;;
+ $height_param = $image->Get('height') * $scaling;;
+ undef $image;
my $epssrc = $src;
$epssrc =~ s/(\.gif|\.jpg)$/\.eps/i;
if (not -e $epssrc) {