[Mapserver-users] saveImage error

Sean Gillies sgillies at frii.com
Tue Jan 6 21:38:01 EST 2004


On Jan 6, 2004, at 4:05 PM, WILHITE JASON W wrote:

> I keep getting the following error when I try and run a very simple  
> perl script using mapserver.  The following is the debug statements  
> along with the error message.
>
>
> 	Hello Starting test!
> 		DEBUG::::  Prep returned mapscript::imageObj=HASH(0x8457140)
> 		DEBUG::::  Draw returned mapscript::imageObj=HASH(0x8457140)
> 		DEBUG::::  ./rawMSTest.png, , 1
> 	Can't call method "saveImage" on an undefined value at rawMSTest.pl  
> line 129.
>
>
> Here is the code snippet in question.
>
> 	#!/usr/sbin/perl
>
> 	use GD;
> 	use CGI;
> 	use POSIX;
>
> 	use strict;
> 	use mapscript;
> 	use Getopt::Long;
>
> 	#
> 	#=================================== MAIN  
> ===================================
> 	#
> 	print "\nHello Starting test!\n";
>
> 	my $mapFileName = "./simpleGauge.map";
> 	my $pngFileName = "./rawMSTest.png";
> 	my $showPNG = 0;
> 	my ( $xMin, $xMax, $yMin, $yMax ) = (-112.39, -111.39, 33.20, 33.62);
>
> 	my $bgMap = new mapscript::mapObj( $mapFileName );
> 	$bgMap->{width} = 600;
> 	$bgMap->{height} = 600;
>
> 	my $imgPrep = $bgMap->prepareImage();
> 	print "\tDEBUG::::  Prep returned $imgPrep\n";
>
> 	my $imageObj = $bgMap->draw();
> 	print "\tDEBUG::::  Draw returned $imgPrep\n";
>
> 	`rm -f $pngFileName`;
> 	print "\tDEBUG::::  $pngFileName, $mapscript::MS_PNG,  
> $bgMap->{transparent}\n";
>
> 	my $image_url = $imageObj->saveImage( $pngFileName,   
> $mapscript::MS_PNG, $bgMap->{transparent}, 1, 95 ); <------Line where  
> it is dying
> 	print "\tDEBUG::::  Save returned $image_url\n";
>
> 	if ($showPNG) {
> 		print "\nee'ing image file $pngFileName\n";
> 		`ee $pngFileName`;
> 	}
>
>
> 	print "\nAll done!\n";
>
> 	 
> #====================================================================== 
> =====
>
>
> Am I missing something incredibly obvious?  This worked on Mapserver  
> 3.6.4 but when I upgrade to mapserver 4.0.1 it blows up.
> Any ideas?
>
> Thanks,
> -Jason
>
>

Jason,

There is no imageObj::saveImage -- it's 'save' and you no longer need
to specify output format parameters because these are no held in the
imageObj instance.  Check out the online docs for more details.

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies




More information about the mapserver-users mailing list