<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi All,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I managed to solve my problem of getting chameleon
to serve a GIF for vector data, and a JPEG for full-colour imagery. If anyone is
interested in doing a similar thing, insert the code below in the drawmap.php
file, before the line that says
"$oMapSession->oMap->selectOutputFormat($szImgType);"</FONT></DIV>
<DIV><FONT face=Arial size=2>The difference in filesize and quality make it well
worth for users on a dial-up connection.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>In the mapfile, you'd have to specify a parameter
in the metadata called FORCEJPG, if you want that layer to turn the mapimage to
a JPEG.</FONT></DIV>
<DIV><FONT face=Arial
size=2>-------------------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2> for ($i=0;
$i<$oMapSession->oMap->numlayers; $i++)<BR>
{<BR> $oLayer =
$oMapSession->oMap->getlayer($i);<BR>
if ( ( $oLayer->getMetadata("FORCEJPG") ) && ($oLayer->status ==
true) )<BR>
{<BR> $forceJPG =
true;<BR> }<BR>
}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> if ($forceJPG ==
true)<BR> {<BR> $szImgType =
"JPEG";<BR> }<BR> else<BR>
{<BR> $szImgType = "GIF";<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial color=#0000ff
size=2>---------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT color=#0000ff></FONT> </DIV>
<DIV><FONT color=#0000ff></FONT> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
chameleon-bounces@lists.maptools.org
[mailto:chameleon-bounces@lists.maptools.org] <B>On Behalf Of </B>Jacob
Delfos<BR><B>Sent:</B> 24 August 2004 11:44<BR><B>To:</B>
chameleon@lists.maptools.org<BR><B>Subject:</B> Re: [Chameleon] change
imagetype on the fly<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Thanks Paul,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>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...).</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Jacob</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>-----Original Message-----<BR>From: Paul Spencer
[mailto:pagameba@magma.ca] <BR>Sent: 23 August 2004 20:31<BR>To: Jacob
Delfos<BR>Cc: <A
href="mailto:chameleon@lists.maptools.org">chameleon@lists.maptools.org</A><BR>Subject:
Re: [Chameleon] change imagetype on the fly</DIV>
<DIV> </DIV>
<DIV><BR>$http_form_vars is either POST or GET, not both. You could
try:</DIV>
<DIV> </DIV>
<DIV>$http_form_vars = array_merge( $_POST, $_GET );</DIV>
<DIV> </DIV>
<DIV>You can also:</DIV>
<DIV> </DIV>
<DIV>print_r($http_form_vars);</DIV>
<DIV> </DIV>
<DIV>and then view the source of your image to see the contents of the
array?</DIV>
<DIV> </DIV>
<DIV>Cheers,</DIV>
<DIV> </DIV>
<DIV>Paul</DIV>
<DIV> </DIV>
<DIV>Jacob Delfos wrote:</DIV>
<DIV> </DIV>
<DIV>> Paul,<BR>> <BR>> You are right, if I hardcode the
szImgType variable, it changes the <BR>> imagetype. But it doesn't seem to
want to change any other way. There is <BR>> this piece of code in there
which doesn't seem to have any effect:<BR>> <BR>> if
(isset($http_form_vars["gszImgType"]) && <BR>>
$http_form_vars["gszImgType"] != "")<BR>>
$szImgType = $http_form_vars["gszImgType"];<BR>> <BR>> The way I
see this, it should allow a parameter in the form called <BR>> gszImgType
to override the imagetype. Why doesn't it work? Even if I <BR>> just
try<BR>> <BR>> isset($http_form_vars["gszImgType"])<BR>>
<BR>> and place the gszImgType in the url as a parameter, or in the form as
an <BR>> input type, it acts as if this variable isn't set. I'm not much of
a php <BR>> expert, but I thought the isset function checks whether a
parameter has <BR>> a value.....<BR>> <BR>> Is it because I use
a mapfile?<BR>> <BR>> regards,<BR>> <BR>>
Jacob<BR>> <BR>> <BR>> <BR>> <BR>>
-----Original Message-----<BR>> From: Paul Spencer
[mailto:pagameba@magma.ca]<BR>> Sent: 19 August 2004 10:09<BR>> To:
Jacob Delfos; <A
href="mailto:chameleon@lists.maptools.org">chameleon@lists.maptools.org</A>
<BR>> <<A
href="mailto:chameleon@lists.maptools.org">mailto:chameleon@lists.maptools.org</A>><BR>>
Subject: Re: [Chameleon] change imagetype on the fly<BR>> <BR>>
<BR>> Jacob, you should be able to modify the image type in drawmap.php
since <BR>> this is the only<BR>> place that it actually draws the
map. Note that drawmap does not save <BR>> the map state, so<BR>>
you would have to change it on every map draw. The code would look
<BR>> something like:<BR>> <BR>> $oMap->selectOutputFormat(
'GIF' );<BR>> <BR>> I think. And you could insert this just
before the $oMap->draw(); <BR>> call. You could also<BR>> (at
the risk of adding a little overhead) loop through all the layers in <BR>>
the map and test<BR>> for the layer types and only switch to jpeg when a
raster layer is <BR>> visible ...<BR>> <BR>>
Cheers,<BR>> <BR>> Paul<BR>> <BR>>
<BR>> <BR>> On Aug 18, "Jacob Delfos" <<A
href="mailto:jacob.delfos@maunsell.com">jacob.delfos@maunsell.com</A> <BR>>
<<A
href="mailto:jacob.delfos@maunsell.com">mailto:jacob.delfos@maunsell.com</A>>>
wrote:<BR>> > Hi List,<BR>> ><BR>>
><BR>> ><BR>> > I am attempting to modify chameleon
to allow the imagetype to change <BR>> on the fly.<BR>> Ideally, I want
to reach a situation where chameleon is smart enough to <BR>> know it
should use<BR>> gif, except when an aerial photograph is in the background.
This will <BR>> greatly increase the<BR>> speed of the page, because my
jpeg maps are typically around 88kb, <BR>> whereas a gif would be<BR>>
ten times smaller for linework and areas.<BR>> ><BR>>
><BR>> ><BR>> > I tried to override the nImageType
in drawmap.php by making it pick <BR>> it up from the http<BR>>
parameters. But even if I hardcode the nImageType variable, I keep <BR>>
getting a jpeg. Also<BR>> (which may be the cause), the temporary map files
that are created <BR>> specify jpeg as imagetype.<BR>>
><BR>> ><BR>> ><BR>> > If I want to
override the imagetype, where do I change that?<BR>>
><BR>> ><BR>> ><BR>> >
regards,<BR>> ><BR>> ><BR>>
><BR>> > Jacob<BR>> ><BR>>
><BR>> ><BR>> ><BR>> ><BR>>
><BR>> ><BR>> > JACOB DELFOS<BR>>
><BR>> > SPATIAL INFORMATION ANALYST<BR>>
><BR>> > Maunsell Australia Pty Ltd<BR>>
><BR>> > 629 Newcastle Street<BR>> ><BR>>
> PO Box 81<BR>> ><BR>> > Leederville
6902<BR>> ><BR>> > Western Australia<BR>>
><BR>> > ABN 20 093 846 925<BR>> ><BR>>
><BR>> ><BR>> > Tel + 61 8
9281 6185<BR>> ><BR>> > Fax + 61 8
9281 6297<BR>> ><BR>> > <A
href="mailto:jacob.delfos@maunsell.com">jacob.delfos@maunsell.com</A> <<A
href="mailto:jacob.delfos@maunsell.com">mailto:jacob.delfos@maunsell.com</A>><BR>>
><BR>> >
_______________________________________________<BR>> > Chameleon
mailing list<BR>> > <A
href="mailto:Chameleon@lists.maptools.org">Chameleon@lists.maptools.org</A>
<<A
href="mailto:Chameleon@lists.maptools.org">mailto:Chameleon@lists.maptools.org</A>><BR>>
> <a<BR>>
href='http://lists.maptools.org/mailman/listinfo/chameleon'>http://lists.maptools.org/mailman/listinfo/chameleon</a><BR>>
><BR>> ><BR>> <BR>> if
(isset($http_form_vars["gszImgType"]) && <BR>>
$http_form_vars["gszImgType"] != "")<BR>>
$szImgType = $http_form_vars["gszImgType"];<BR>> <BR>> <BR>>
------------------------------------------------------------------------<BR>>
<BR>> _______________________________________________<BR>> Chameleon
mailing list<BR>> <A
href="mailto:Chameleon@lists.maptools.org">Chameleon@lists.maptools.org</A><BR>>
<A
href="http://lists.maptools.org/mailman/listinfo/chameleon">http://lists.maptools.org/mailman/listinfo/chameleon</A></DIV>
<DIV> </DIV>
<DIV>-- <BR>
-----------------------------------------------------------------<BR>|Paul
Spencer
<A
href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</A>
|<BR>|-----------------------------------------------------------------|<BR>|Applications
& Software
Development
|<BR>|DM Solutions Group
Inc
<A href="http://www.dmsolutions.ca/">http://www.dmsolutions.ca/</A>|<BR>
-----------------------------------------------------------------<BR></FONT></DIV></BLOCKQUOTE></FONT></DIV></BODY></HTML>