-
|
We have been using php's imagecreatefromgd2part function for almost two decades to read and decompress only small part of a large image file (topo maps) to publish WMS and WMTS services (OGC Web Map Service / Web Map Tile Service). It has been handy, fast and lightweigt way to read only the needed part of a large image and then re-project it to the projection (coordinate system) and resolution requested, with php. However, apparenly support for gd2 format got dropped. So, what is the best alternative for this, the best libgd way to read only part of a large compressed image file with php? Reading the the whole image, de-compressing it all and then copying the part sure works, but it is too slow and heavy operation for any higher load services gd2 is/was used. I could not find any libgd (or php) functions for reading just parts of a image other than gd2 format, but maybe I am missing something. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
gd2 is disabled by default in libgd, but you can turn it back on if you compile it yourself. I can't speak for php behavior though. |
Beta Was this translation helpful? Give feedback.
-
|
Well, tried that, but some of the apps are on shared hosts and hosting providers say gd2 format is permanently disbled and removed, not coming back. Dropping gd2 format before having an about lightweight alternative way for reading a part of a large image was not the smartest move. Imagecreatefromgd2part is/was used under the hood for two decades for WMS and multi projection WMTS services - raster maps stored only once as larger gd2 files, requested part cropped with Imagecreatefromgd2part and reprojected if needed. No need to decompress much extra data, no need to store rasters in multiple projections, no need to pre-process tiles for various projections. Low cpu and memory use, easily with tiny scripts. I find it quite unfortunate that all is now gone, libgd (or php) as it is now isn't that practical for this purpose any more. Adding support for reading part of a some other tiled well compressed raster format before removing the gd2 support would have helped a lot. |
Beta Was this translation helpful? Give feedback.
feel free to ask the PHP folks about enabling it in their builds as many people use the version bundled with it. this project doesn't control PHP.