Diff for /loncom/xml/londefdef.pm between versions 1.209 and 1.210

version 1.209, 2004/04/15 17:37:04 version 1.210, 2004/04/15 19:08:31
Line 2333  sub start_img { Line 2333  sub start_img {
  if ($height) { $currentstring.=' height="'.$height.'" '; }   if ($height) { $currentstring.=' height="'.$height.'" '; }
  $currentstring .= ' />';   $currentstring .= ' />';
     } elsif ($target eq 'modified') {      } elsif ($target eq 'modified') {
  my $constructtag=&Apache::edit::get_new_args($token,$parstack,   my ($osrc,$owidth,$oheight)=
      $safeeval,'src','alt',      ($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'});
      'TeXwidth','TeXheight',   my $ctag=&Apache::edit::get_new_args($token,$parstack,
      'width','height');       $safeeval,'src','alt',
  $src=$token->[2]{'src'};       'TeXwidth','TeXheight',
  if (!$token->[2]{'width'} && !$token->[2]{'height'}) {       'width','height');
     $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);   my ($nsrc,$nwidth,$nheight)=
     &image_replication($src);      ($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'});
     if (-e $src) {   my $loc=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$nsrc);
  my $image = Image::Magick->new;   &image_replication($loc);
  $image->Read($src);   my ($iwidth,$iheight);
  my ($width, $height) = ($image->Get('width'),   &Apache::lonnet::logthis("loc is $loc");
  $image->Get('height'));   if (-e $loc) {
  if ($width && $height) {      my $image = Image::Magick->new;
     $token->[2]{'width'} =$width;      $image->Read($loc);
     $token->[2]{'height'}=$height;      ($iwidth, $iheight) = ($image->Get('width'),
     $constructtag=1;     $image->Get('height'));
    }
    if ($osrc ne $nsrc || (!$nwidth && !$nheight)) {
       # changed image or no size specified,
               # if they didn't explicitly change the 
               # width or height use the ones from the image
       if ($iwidth && $iheight) {
    if ($owidth == $nwidth || (!$nwidth && !$nheight)) {
       $token->[2]{'width'} = $iwidth;$ctag=1;
    }
    if ($oheight == $nheight || (!$nwidth && !$nheight)) {
       $token->[2]{'height'}=$iheight;$ctag=1;
  }   }
     }      }
  }   }
  if ($constructtag) {$currentstring=&Apache::edit::rebuild_tag($token);}   my ($cwidth,$cheight)=($token->[2]{'width'},$token->[2]{'height'});
    # if we don't have a width or height
    if ($iwidth && $cwidth && !$cheight) {
       $token->[2]{'height'}=int(($cwidth/$iwidth)*$iheight);$ctag=1;
    }
    if ($iheight && $cheight && !$cwidth) {
       $token->[2]{'width'}=int(($cheight/$iheight)*$iwidth);$ctag=1;
    }
    if ($ctag) {$currentstring=&Apache::edit::rebuild_tag($token);}
     }      }
     return $currentstring;      return $currentstring;
 }  }

Removed from v.1.209  
changed lines
  Added in v.1.210


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>