Changes between Initial Version and Version 1 of SWIGMapScriptOpacity


Ignore:
Timestamp:
2019-05-16T08:28:11-03:00 (5 years ago)
Author:
Jeff McKenna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SWIGMapScriptOpacity

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