version 1.31, 2003/06/09 22:42:49
|
version 1.32, 2003/07/31 20:38:12
|
Line 318 sub end_image {
|
Line 318 sub end_image {
|
my $name = $Apache::imageresponse::curname; |
my $name = $Apache::imageresponse::curname; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my $image = &Apache::lonxml::endredirection; |
my $image = &Apache::lonxml::endredirection; |
&Apache::lonxml::debug("out is $image"); |
&Apache::lonxml::debug("original image is $image"); |
|
my $id=$Apache::inputtags::response['-1']; |
|
my $temp=1; |
|
my $x=$ENV{"form.HWVAL_$id:$temp.x"}; |
|
my $y=$ENV{"form.HWVAL_$id:$temp.y"}; |
|
if (defined ($x) && defined ($y)) { |
|
&Apache::lonxml::debug("x and y defined as $x,$y"); |
|
my $magickImage = Image::Magick->new; |
|
my $currentImage = $magickImage->Read('/home/httpd/html'.$image); |
|
my $length = 6; |
|
$currentImage = $magickImage->Draw(primitive=>'line', |
|
stroke=>'red', |
|
points=>($x-$length).','.($y-$length).' '. |
|
($x+$length).','.($y+$length)); |
|
$currentImage = $magickImage->Draw(primitive=>'line', |
|
stroke=>'red', |
|
points=>($x-$length).','.($y+$length).' '. |
|
($x+$length).','.($y-$length)); |
|
binmode STDOUT; |
|
my ($graphExt) = ($image =~ /.*\.(.*)$/); |
|
&Apache::lonxml::debug("graph mime type $graphExt"); |
|
my $webImageName = "/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_".(time).'.'.$graphExt; #needs to be more random |
|
my $newImageName = '/home/httpd'.$webImageName; |
|
|
|
$currentImage = $magickImage->Write($graphExt.':'.$newImageName); |
|
undef $magickImage; |
|
$image = $webImageName; |
|
} |
|
&Apache::lonxml::debug("out image is $image"); |
if ( $Apache::imageresponse::conceptgroup |
if ( $Apache::imageresponse::conceptgroup |
&& !&Apache::response::showallfoils()) { |
&& !&Apache::response::showallfoils()) { |
$Apache::response::conceptgroup{"$name.image"} = $image; |
$Apache::response::conceptgroup{"$name.image"} = $image; |