Repository navigation
Fix 6411 imagick gd fallback - #9909
Open
boredskull wants to merge 3 commits into
Open
boredskull wants to merge 3 commits into
boredskull wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This pull request addresses issue #6411, where SMF image processing can fail when ImageMagick is installed but lacks support for a particular image format.
Currently, SMF prioritises ImageMagick whenever the Imagick PHP extension is available. However, this does not guarantee that the installed ImageMagick configuration supports every image format.
As a result, operations such as uploading avatars, resizing images and generating attachment thumbnails can fail, even when the GD extension is available and capable of processing the image.
This PR introduces format detection and fallback handling to make image processing more reliable.
Changes Made
1. ImageMagick format detection
Imagick::queryFormats()to identify formats supported by the installed ImageMagick configuration.2. GD fallback support
3. Improved image handling
getimagesize()fallback to execute when ImageMagick cannot determine image dimensions.Files Modified
Sources/Graphics/Image.phpThe changes are contained within the existing image-processing class. No database changes, template modifications or additional dependencies are introduced.
Testing
Completed:
Sources/Graphics/Image.phpwas modified.Further testing required:
Full runtime and browser-based testing has not yet been completed in an environment with both Imagick and GD extensions installed.
Expected Result
SMF should continue to use ImageMagick where supported, but automatically attempt GD when ImageMagick cannot process a format that GD supports.
This should prevent avoidable image-processing failures and improve compatibility with hosting environments where ImageMagick has limited format support.
Issues References (Fixes|Related|Closes)
Related #6411