Re: [MapServer-users] PHP-Mapscript: write imageObj to stdout

2023-11-13 Thread Vassilis Chatzigiannakis via MapServer-users
Yes, in php using swig it would be: 

$oImg = $this->oMap->draw();
echo $oImg->getBytes()

-Original Message-
From: MapServer-users  On Behalf Of 
Sven Schroeter via MapServer-users
Sent: Monday, November 13, 2023 10:44 AM
To: mapserver-users@lists.osgeo.org
Subject: Re: [MapServer-users] PHP-Mapscript: write imageObj to stdout

Hi Jan,

maybe you need this:

         //SWIG
         if($mapscriptSwig) {
             echo msIO_getStdoutBufferBytes();
         }else{
             echo ms_iogetStdoutBufferBytes();
         }

Sven


Am 10.11.2023 um 18:59 schrieb Jan Hartmann via MapServer-users:
>
> Hi,
>
> In previous versions of PHP-Mapscript there was a function
> ImageObj->saveImage(fn), that wrote an ImageObj to a file on disk. 
> When fn was empty, the image was sent to stdout. In SWIG-Mapscript, 
> this function has been replaced by ImageObj->save(fn), but fn cannot 
> be empty anymore. How do I send an ImageObj directly to stdout (i.e.
> to the browser)?
>
> Jan
> ___
> MapServer-users mailing list
> MapServer-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users


___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

2023-10-29 Thread Vassilis Chatzigiannakis via MapServer-users
Yes the documentation is a mess .
I worked with this reference:

https://mapserver.org/mapscript/mapscript-api/index.html

So, you start by
$oMap = new mapObj($mapfile);

Best regards,
Vassilis


From: Jan Hartmann 
Sent: Saturday, October 28, 2023 9:14 PM
To: Vassilis Chatzigiannakis ; mapserver-users@lists.osgeo.org
Subject: Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

This seems to work.  And it says so in the migration guide 
(https://mapserver.org/mapscript/php/migration_guide.html):

all of your PHP scripts (that leverage MapServer objects and functions) must 
now always first include the generated mapscript.php file containing MapServer 
constants:

But could it be that only "$m = new mapObj('...');" is accepted, and 
"$m=ms_newMapObj('...');" isn't? The docs still mention the old call 
(https://mapserver.org/mapscript/php/phpmapscript.html
On 28/10/2023 09:11, Vassilis Chatzigiannakis wrote:
Hi,
I did it recently. There should be a mapscript.php file in the same folder as 
the  php_mapscriptng.so extension.
You need to include it in your php script.

Best,
Vassilis


From: MapServer-users 

 On Behalf Of Jan Hartmann via MapServer-users
Sent: Friday, October 27, 2023 9:42 PM
To: mapserver-users@lists.osgeo.org
Subject: Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

I made a docker version of mapserver/php-mapscript myself, based on Ubuntu 
22.04. I installed all required libraries with apt, and compiled mapserver and 
mapscript according to instructions. No problem at all.

At the end I got the following from phpinfo();



mapscript
MapServer Version
MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.4 OUTPUT=PNG 
OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS INPUT=JPEG 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF

But no mapscript function or object was regognized in my PHP-scripts:

PHP Fatal error:  Uncaught Error: Class "mapObj" not found in 
/virdir/www_root/test.php:2
Stack trace:
#0 {main}
  thrown in /virdir/www_root/test.php on line 2


I am really desparate. Has anyone ever succeeded to get php_mapscriptng.so to 
work?  Or does anyone know of a working Docker image for MapServer with PHP 
MapScript?

Jan
On 21/10/2023 05:40, Jan Hartmann wrote:
I tried this with serveral versions of PHP and MapServer, but got always the 
same result. Can anyone point me to a Docker image for MapServer + 
PHP-MapScript?

Jan
On 19/10/2023 18:12, Jan Hartmann wrote:
Still not there. Everything has been installed, and phpinfo() gives:
MapServer Version
MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.7 OUTPUT=PNG 
OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER INPUT=JPEG INPUT=POSTGIS INPUT=OGR 
INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF

But calling "$map = new mapObj('mapfile.map');" gives:

Fatal error: Uncaught Error: Class "mapObj" not found in 
/mnt/virdir/www_root/test/test_mapscript.php:2 Stack trace: #0 {main} thrown in 
/mnt/virdir/www_root/test/test_mapscript.php on line 2

Any idea?

Jan



___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

2023-10-28 Thread Vassilis Chatzigiannakis via MapServer-users
Hi,
I did it recently. There should be a mapscript.php file in the same folder as 
the  php_mapscriptng.so extension.
You need to include it in your php script.

Best,
Vassilis


From: MapServer-users  On Behalf Of 
Jan Hartmann via MapServer-users
Sent: Friday, October 27, 2023 9:42 PM
To: mapserver-users@lists.osgeo.org
Subject: Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

I made a docker version of mapserver/php-mapscript myself, based on Ubuntu 
22.04. I installed all required libraries with apt, and compiled mapserver and 
mapscript according to instructions. No problem at all.

At the end I got the following from phpinfo();


mapscript
MapServer Version
MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.4 OUTPUT=PNG 
OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS INPUT=JPEG 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF

But no mapscript function or object was regognized in my PHP-scripts:

PHP Fatal error:  Uncaught Error: Class "mapObj" not found in 
/virdir/www_root/test.php:2
Stack trace:
#0 {main}
  thrown in /virdir/www_root/test.php on line 2


I am really desparate. Has anyone ever succeeded to get php_mapscriptng.so to 
work?  Or does anyone know of a working Docker image for MapServer with PHP 
MapScript?

Jan
On 21/10/2023 05:40, Jan Hartmann wrote:
I tried this with serveral versions of PHP and MapServer, but got always the 
same result. Can anyone point me to a Docker image for MapServer + 
PHP-MapScript?

Jan
On 19/10/2023 18:12, Jan Hartmann wrote:
Still not there. Everything has been installed, and phpinfo() gives:
MapServer Version
MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.7 OUTPUT=PNG 
OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER INPUT=JPEG INPUT=POSTGIS INPUT=OGR 
INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF

But calling "$map = new mapObj('mapfile.map');" gives:

Fatal error: Uncaught Error: Class "mapObj" not found in 
/mnt/virdir/www_root/test/test_mapscript.php:2 Stack trace: #0 {main} thrown in 
/mnt/virdir/www_root/test/test_mapscript.php on line 2

Any idea?

Jan


___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


[MapServer-users] Mapserver 8 , PHP map script cannot print image

2023-10-26 Thread Vassilis Chatzigiannakis via MapServer-users
Dear all,

We are using Mapserver 8.0.1 with PHP and the php_mapscriptng extension.

I am having a hard time outputting the image to the browser.

In the following code snippet, saving to disk works but 
mapscript.imageObj.write does not output the image in the browser.

header('Content-type: image/png');
$oImg=$oMap->draw();
$oImg->save("/tmp/mswms.png");
$oImg->write();


Do you have a working PHP example of
https://mapserver.org/mapscript/mapscript-api/stub/mapscript.imageObj.html#mapscript.imageObj.write?

Or is there another way of showing the image in the browser?

Best regards,
Vassilis



___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users