Mapscript image object creation.

Abe Gillespie abe.gillespie at GMAIL.COM
Thu Dec 15 14:50:03 PST 2005


I like this; very very useful!  Thanks a ton!

-Abe

On 12/15/05, Dave Fuhry <dfuhry at gmail.com> wrote:
> Abe,
>
>    Turn on php's output buffering, write to the buffer, assign the
> buffer's contents to a variable, then clean (empty; not flush) the
> buffer:
>
> ob_start();
> header('Content-type: image/png');
> $image->saveImage('');
> $image_data = ob_get_contents();
> ob_end_clean();
>
>    More examples of this on
> http://www.php.net/manual/en/function.ob-get-contents.php and the
> related functions' pages.
>
> -Dave Fuhry
>
> On 12/14/05, Abe Gillespie <abe.gillespie at gmail.com> wrote:
> > That's a very nifty trick that I wasn't familiar with.  Now for
> > another wish.  Can you convert a MapServer image object to a PHP image
> > object in memory?  I've always assumed you couldn't and would first
> > save the image to disk and then load the file in PHP.  It'd be more
> > desirable to skip the disk writing part.
> >
> > Thanks.
> > -Abe
> >
> > On 12/14/05, Mark Wright <sparkymeister at gmail.com> wrote:
> > > In the map img tag set the src attribute to a php file with a
> > > querystring stating everything needed to get the correct map and
> > > settings. When it's time to save the generated image do the following:
> > >
> > > header('Content-type: image/png');
> > > $image->saveImage('');
> > >
> > > This will send the image to the browser instead of saving it to disk
> > > and set the proper mime type so that the browser knows it is receiving
> > > image data. If you are generating an image in a format other than png
> > > simply change the content-type to match.
> > >
> > >
> > > Mark
> > >
> > > On 12/14/05, Paul Moen <pmoen at state.nd.us> wrote:
> > > > Does anyone know how to take an ImageObj in Mapscript and send the output to a variable in PHP
> > > > rather than to standard out or a disk file?
> > > >
> > > > I am looking for something like $imageVar = $imgOb->saveImage('');
> > > >
> > >
> > >
> > > --
> > > Have fun or die trying - but try not to actually die.
> > > http://www.AboveCalifornia.com
> > > Got Mac OS X? Get the AboveCalifornia Sherlock Channel:
> > > sherlock://www.AboveCalifornia.com/sherlock/SherlockChannel.xml?action=add
> > >
> >
>



More information about the MapServer-users mailing list