Emulating mode=map with python mapscrip t

Ryan, Adam ARyan at CO.LINN.OR.US
Wed Dec 8 12:07:30 PST 2004


Weird...neither of these works for me:
---------
print "Content-type: image/png"
print
print mapImg.write()
---------
mapImg.save("myimg.png")
content = open("myimg.png").read()
print "Content-type: image/png"
print
print content
---------

Using the latter method the file is saved and looks fine (opening it up from
Windows explorer), it's just not getting to the browser w/o errors.

Adam

> -----Original Message-----
> From: Howard Butler [mailto:hobu at iastate.edu]
> Sent: Wednesday, December 08, 2004 11:55 AM
> To: Ryan, Adam; MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: Emulating mode=map with python mapscrip t
>
>
> Adam,
>
> No, as I was saying this is an older mapscript variant.  Do
> what you were
> doing, but just add an extra \n by giving it a print with a blank
> line.  Sorry for the confusion.
>
> print "Content-type: image/jpeg"
> print
> print mapImg.write()
>
> At 01:49 PM 12/8/2004, Ryan, Adam wrote:
> >Hey, thanks for the reply.
> >
> >So I have to save the image in order to spit it back?  Is
> there no way
> >to do this w/o saving?
> >
> >Adam
> >
> > > -----Original Message-----
> > > From: Howard Butler [mailto:hobu at IASTATE.EDU]
> > > Sent: Wednesday, December 08, 2004 11:39 AM
> > > To: MAPSERVER-USERS at LISTS.UMN.EDU
> > > Subject: Re: [UMN_MAPSERVER-USERS] Emulating mode=map with python
> > > mapscript
> > >
> > >
> > > I think you need a blank line after the content type.
> Here is how I
> > > did it with earlier mapscript
> > >
> > > >             print "Content-type: image/jpeg"
> > > >             print
> > > >             output = open(drgimagefilename, 'rb').read()
> > > >             print output
> > >
> > > That extra print statement after the printing of the content type
> > > ends the header block.
> > >
> > > Howard
> > >
>



More information about the MapServer-users mailing list