[Mapserver-users] another perl mapscript problem

Dana Quinn dana at nextbus.com
Tue Dec 17 14:40:29 EST 2002


Lowell-
	Thanks for your help!  This was a great idea.  I have this
now:
 >
print $query->header('image/gif');

$img->saveImage("/tmp/map3.gif",$mapscript::MS_GIF, $map->{transparent}, 
$map->{interlace}, 0);
system("cat /tmp/map3.gif");
 >

and it works just great through the browser, no error messages in the
error_log, nothing.  Any ideas what could cause the problems when using
the img->saveImage call?  I will try running it both ways under
strace, and see if I can see any differences in what's being sent out.

dana

Lowell Filak wrote:

> If you change your saveImage line so the image is saved to a system file and then:
> system("cat $image_name");
> do you get the same error?
> If so then $query may not be setup correctly and is indeed not forwarding the content-type.
> You mentioned you already tried sending content-type manually, do you mean:
> print "Content-type: image/gif\n\n";
> ?
> Lowell F.
> 
> The following message was sent by Dana Quinn <dana at nextbus.com> on Tue, 17 Dec 2002 10:11:19 -0800.
> 
> 
>>Hi - I'm having another perl mapscript problem, and I
>>was hoping someone could help me find a clue.  Basically,
>>I'm trying to get a pre-existing perl cgi we have working
>>with the 3.6.3 version of mapserver, perl 5.8, and
>>RedHat Linux 8.0.  I'm almost there, and I think probably
>>some stupid problem is keeping me from finishing this.
>>
>>Here's a code snippet - we've done all our image creation
>>work, and we're ready to output it to the browser - (we
>>are using CGI.pm, btw):
>>
>> >
>>print $query->header('image/gif');
>>
>>#
>>$img->saveImage(undef,$mapscript::MS_GIF, $map->{transparent}, 
>>$map->{interlace}, 0);
>> >
>>
>>very simple, yeah?  If I change the 'saveImage' call to write
>>to a file on the filesystem, it works perfectly, I get a
>>saved gif that I'm able to view, and it works great.
>>
>>If I use undef, like above, to output to the browser, I
>>get a '500 Server Error', and get this in my server error
>>logs:
>>[Mon Dec 16 18:29:28 2002] [error] [client 64.164.28.194] malformed 
>>header from script. Bad header=GIF87aX^B<F4>^A<E7>: 
>>/usr/local/apache/cgi-bin/mapserv.pl
>>
>>It kinda looks like the browser isn't seeing the Content-Type
>>header...  but that's what the 'query->header' business is
>>supposed to do.  So I've tried printing it by hand, no dice.
>>There must be some stupid thing I'm missing - does anyone have
>>any ideas what I'm doing wrong?
>>
>>Dana
>>
>>-- 
>>
>>Dana Quinn, dana at nextbus.com
>>NextBus Information Systems
>>(510) 420-3117
>>
>>_______________________________________________
>>Mapserver-users mailing list
>>Mapserver-users at lists.gis.umn.edu
>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 



-- 

Dana Quinn, dana at nextbus.com
NextBus Information Systems
(510) 420-3117




More information about the mapserver-users mailing list