[mapserver-users] Fwd: Re: [MS4W-Users] transparency with php mapscript
Sven Schroeter
schroeter at netgis.de
Wed May 22 00:53:53 PDT 2019
Hi all,
I'm fighting with the SWIG PHP 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?
Thanks + Greeting
Sven
More information about the MapServer-users
mailing list