Skip to content

refactor(image): modernize GD image helper and fix minor handling inconsistencies#61637

Draft
joshtrichards wants to merge 1 commit into
masterfrom
jtr/refactor-image-modernize
Draft

refactor(image): modernize GD image helper and fix minor handling inconsistencies#61637
joshtrichards wants to merge 1 commit into
masterfrom
jtr/refactor-image-modernize

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Jun 28, 2026

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Modernize OC\Image and simplify several code paths in the GD-backed image helper.

Alongside the cleanup, this also fixes a few minor behavioral inconsistencies in image loading/output and EXIF orientation handling.

Changes:

  • tighten typing
  • use match expressions where they improve readability
  • drop docblocks already covered by the OCP\IImage interface
  • add and improve class/property comments
  • add docblocks to key internal functions
  • simplify output and load paths to reduce branching and duplicated logic
  • extract animated WebP detection into a dedicated helper
  • tighten failure handling for unsupported or invalid image inputs
  • improve EXIF/orientation handling and related return behavior
  • eliminate some duplicate code and make future deduplication easier

Minor fixes included:

  • fix WebP output so saving to a file uses the requested destination path (replaces fix(image): honor file path when saving WebP images #61598)
  • make flip-only EXIF orientation fixes report success consistently
  • align BMP handling with the validation/support checks used for other formats
  • make base64 decoding/loading stricter and consistent with raw-data loading

This is primarily a refactor/cleanup of the existing image helper and does not change its overall responsibilities or public behavior beyond the minor fixes above.

TODO

  • Explore existing test coverage gaps

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug feature: previews and thumbnails ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) technical debt 🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant