--- loncom/xml/londefdef.pm 2002/07/11 14:40:14 1.69 +++ loncom/xml/londefdef.pm 2002/07/11 18:20:00 1.70 @@ -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 Apache::lonnet; use strict; use Apache::lonxml; use Apache::File(); +use Image::Magick; BEGIN { @@ -1310,7 +1311,7 @@ EDITBUTTON 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 @@ EDITBUTTON } 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) {