Cater to optional support of GD/GD2 image formats #15006
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to libgd 2.3.0, support for the proprietary GD and GD2 image formats has was mandatory. However, as of that version libgd can be built without support for these formats[1], and as of libgd 2.3.3 by default these formats are not supported[2].
If libgd is built without support for a certain image format, the respective reader and writer functions are still defined, but they are NOPs. However, PHP GD users expect the reader and writer function to only be defined, if there is actual support, so we're checking for the support during build time, and declare the
HAVE_GD_GD
macro only if support for the GD and GD2 image formats is available.We do not change the bundled libgd to make support for these formats optional, yet.
[1] libgd/libgd#428
[2] https://github.com/libgd/libgd/blob/master/CHANGELOG.md#233---2021-09-12
Just the first step. Yet missing:
gd_info()
, PHP info and imagetypes()imagecreatefromstring()
and maybe more. I'll continue to work on this ASAP, but wouldn't be sad if someone else would take over, or at least help with testing on Linux with system libgd.