[MS4W-Users] transparency with php mapscript

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed May 22 08:47:58 EDT 2019


Hi Sven,

You found a good one.  It took me some time to figure out what is happening.

In fact this is due to MS4W 4.0.0 being compiled with Pixman support; 
unfortunately I had hit this back in 2016 and removed Pixman for that 
reason.  Here we are again though :)  I'll remove Pixman for the next 
MS4W 4.0.1 release.  Follow along the progress at 
https://ms4w.com/trac/ticket/218

Thanks for reporting this.

-jeff


--

Thank you for using MS4W.
"MS4W: open doors as well as windows"


-- 
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/




On 2019-05-21 7:41 AM, Sven Schroeter via MS4W-Users wrote:
> Hi Jeff,
> 
> I'm fighting with the SWIG MapScript Opacity again and found a very 
> strange behavior.
> 
> Here is my test script:
> 
> include("../includes/phpmapscriptng-swig/mapscript_70400.php");
> $map = new mapObj(MAPFILE_PATH.'test.map');
> 
> // set image format
> $map->selectOutputFormat("image/jpeg");
> $oRasterLayer = $map->getLayerByName('tk_rlp_tms_grau');
> $oPolyLayer = $map->getLayerByName('grenzen_vg');
> 
> $oRasterLayer->setOpacity(10);
> $oRasterLayer->status = MS_ON;
> 
> $oPolyLayer->setOpacity(30);
> $oPolyLayer->status = MS_ON;
> 
> // set image size
> $map->setsize(1000,768);
> $map->setextent(300497,5495624,366043,5558489);
> 
> // Bild im MapServer IMAGEPATH abspeichern.
> $image = $map->draw();
> 
> //Bildname, Extension und Pfad
> $picname = md5(rand());
> $picext = ".jpeg";
> 
> $picpathname = MS_TMP_PATH.$picname.$picext;
> 
> // Bild im MapServer IMAGEPATH abspeichern.
> $mapimage = $image->save($picpathname,$map); //URL
> 
> 
> $imgurl = MS_TMP_URL.$picname.$picext;
> 
> //header('Location: '.$imgurl);
> 
> echo '<img src="'.$imgurl.'" border="1">';
> 
> 
> 
> If I set the width of the image to a number with 2 zeros at the end 
> everything works fine.
> e.g. $map->setsize(800,814);
> or $map->setsize(1000,768);
> 
> as soon as I change the value for the width of the image it often 
> doesn't work anymore and the layers don't have transparency anymore.
> e.g. $map->setsize(801,814);
> or $map->setsize(1011,768);
> 
> It is extremely difficult to see a pattern here.
> All variants work with the old Mapscript.
> Is this a bug?
> 
> Greeting
> Sven
> 
> 
> 
> 
> Am 16.05.2019 um 13:57 schrieb Jeff McKenna via MS4W-Users:
>> I forgot to mention that that test script uses an important trick to 
>> test: it saves the mapfile to a temporary file, where you can confirm 
>> that a COMPOSITE object is indeed created (here is that script again 
>> https://ms4w.com/trac/wiki/SWIGMapScriptOpacity )
>>
>> -jeff
>>
>>


More information about the MS4W-Users mailing list