[Chameleon] change imagetype on the fly
Jacob Delfos
jacob.delfos at maunsell.com
Mon Aug 23 23:43:48 EDT 2004
Thanks Paul,
I sort of got it working now. My problem was that I didn't realize I was passing parameters into the main php page, which of course wouldn't propagate to drawmap.php (dumb...).
I'm automatically generating a hidden input field in the form when my aerial photo becomes visible (using the legend template). Unfortunately it doesn't get picked up until the next time I submit the form. I may try to resort to iterating through the layers after all. I think it could be a real advantage to switch to indexed colour (GIF) automatically when there is only vector data visible.
Thanks,
Jacob
-----Original Message-----
From: Paul Spencer [mailto:pagameba at magma.ca]
Sent: 23 August 2004 20:31
To: Jacob Delfos
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] change imagetype on the fly
$http_form_vars is either POST or GET, not both. You could try:
$http_form_vars = array_merge( $_POST, $_GET );
You can also:
print_r($http_form_vars);
and then view the source of your image to see the contents of the array?
Cheers,
Paul
Jacob Delfos wrote:
> Paul,
>
> You are right, if I hardcode the szImgType variable, it changes the
> imagetype. But it doesn't seem to want to change any other way. There is
> this piece of code in there which doesn't seem to have any effect:
>
> if (isset($http_form_vars["gszImgType"]) &&
> $http_form_vars["gszImgType"] != "")
> $szImgType = $http_form_vars["gszImgType"];
>
> The way I see this, it should allow a parameter in the form called
> gszImgType to override the imagetype. Why doesn't it work? Even if I
> just try
>
> isset($http_form_vars["gszImgType"])
>
> and place the gszImgType in the url as a parameter, or in the form as an
> input type, it acts as if this variable isn't set. I'm not much of a php
> expert, but I thought the isset function checks whether a parameter has
> a value.....
>
> Is it because I use a mapfile?
>
> regards,
>
> Jacob
>
>
>
>
> -----Original Message-----
> From: Paul Spencer [mailto:pagameba at magma.ca]
> Sent: 19 August 2004 10:09
> To: Jacob Delfos; chameleon at lists.maptools.org
> <mailto:chameleon at lists.maptools.org>
> Subject: Re: [Chameleon] change imagetype on the fly
>
>
> Jacob, you should be able to modify the image type in drawmap.php since
> this is the only
> place that it actually draws the map. Note that drawmap does not save
> the map state, so
> you would have to change it on every map draw. The code would look
> something like:
>
> $oMap->selectOutputFormat( 'GIF' );
>
> I think. And you could insert this just before the $oMap->draw();
> call. You could also
> (at the risk of adding a little overhead) loop through all the layers in
> the map and test
> for the layer types and only switch to jpeg when a raster layer is
> visible ...
>
> Cheers,
>
> Paul
>
>
>
> On Aug 18, "Jacob Delfos" <jacob.delfos at maunsell.com
> <mailto:jacob.delfos at maunsell.com>> wrote:
> > Hi List,
> >
> >
> >
> > I am attempting to modify chameleon to allow the imagetype to change
> on the fly.
> Ideally, I want to reach a situation where chameleon is smart enough to
> know it should use
> gif, except when an aerial photograph is in the background. This will
> greatly increase the
> speed of the page, because my jpeg maps are typically around 88kb,
> whereas a gif would be
> ten times smaller for linework and areas.
> >
> >
> >
> > I tried to override the nImageType in drawmap.php by making it pick
> it up from the http
> parameters. But even if I hardcode the nImageType variable, I keep
> getting a jpeg. Also
> (which may be the cause), the temporary map files that are created
> specify jpeg as imagetype.
> >
> >
> >
> > If I want to override the imagetype, where do I change that?
> >
> >
> >
> > regards,
> >
> >
> >
> > Jacob
> >
> >
> >
> >
> >
> >
> >
> > JACOB DELFOS
> >
> > SPATIAL INFORMATION ANALYST
> >
> > Maunsell Australia Pty Ltd
> >
> > 629 Newcastle Street
> >
> > PO Box 81
> >
> > Leederville 6902
> >
> > Western Australia
> >
> > ABN 20 093 846 925
> >
> >
> >
> > Tel + 61 8 9281 6185
> >
> > Fax + 61 8 9281 6297
> >
> > jacob.delfos at maunsell.com <mailto:jacob.delfos at maunsell.com>
> >
> > _______________________________________________
> > Chameleon mailing list
> > Chameleon at lists.maptools.org <mailto:Chameleon at lists.maptools.org>
> > <a
> href='http://lists.maptools.org/mailman/listinfo/chameleon'>http://lists.maptools.org/mailman/listinfo/chameleon</a>
> >
> >
>
> if (isset($http_form_vars["gszImgType"]) &&
> $http_form_vars["gszImgType"] != "")
> $szImgType = $http_form_vars["gszImgType"];
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
--
-----------------------------------------------------------------
|Paul Spencer pspencer at dmsolutions.ca |
|-----------------------------------------------------------------|
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
-----------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20040824/8bb25c9f/attachment.htm
More information about the Chameleon
mailing list