Changes between Initial Version and Version 1 of SWIGMapScriptOpacity4x


Ignore:
Timestamp:
2021-12-22T12:24:52-04:00 (3 years ago)
Author:
Jeff McKenna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SWIGMapScriptOpacity4x

    v1 v1  
     1= Using setOpacity() method for SWIG !MapScript =
     2
     3{{{
     4#!php
     5<?php
     6
     7// define variables
     8define( "MAPFILE", "C:/ms4w/apps/phpmapscriptng-swig/output.map" );
     9
     10// required SWIG include (contains constants for PHP7)
     11include("C:/ms4w/apps/phpmapscriptng-swig/include/mapscript.php");
     12
     13// open map
     14$oMap = new mapObj(MAPFILE);
     15
     16//force all errors to display
     17//  comment out the next 2 lines, useful on servers not displaying errors
     18ini_set('display_errors','On');
     19error_reporting(E_ALL);
     20
     21// set image size
     22$oMap->setsize(400, 300);
     23
     24// set image format
     25$oMap->selectoutputformat("png");
     26
     27
     28// get layer
     29$oPolyLayer = $oMap->getLayerByName('prov_bound');
     30
     31//***********************************************************************************************
     32// set opacity on the layer
     33//***********************************************************************************************
     34// call setOpacity() (which actually creates a new COMPOSITE object)
     35$oPolyLayer->setOpacity(40);
     36
     37// draw map
     38$oImage = $oMap->draw();
     39
     40// save image file
     41$file = $oImage->save("C:/ms4w/apps/phpmapscriptng-swig/ttt.png",$oMap);
     42
     43//***********************************************************************************************
     44// save mapfile to new file, to see your new COMPOSITE object inside the layer
     45//***********************************************************************************************
     46$oMap->save("C:/ms4w/apps/phpmapscriptng-swig/output2.map");
     47
     48// set header
     49header("Content-type: image/gif");
     50
     51// read image to output buffer
     52readfile("C:/ms4w/apps/phpmapscriptng-swig/ttt.png");
     53
     54?>
     55}}}