Skip to content

[5.3] - Respect individual width/height constraints in Media Action - Resize plugin#45311

Merged
richard67 merged 8 commits intojoomla:5.3-devfrom
travisrisner:5.3-dev-media-resize-plugin-fix
Apr 19, 2025
Merged

[5.3] - Respect individual width/height constraints in Media Action - Resize plugin#45311
richard67 merged 8 commits intojoomla:5.3-devfrom
travisrisner:5.3-dev-media-resize-plugin-fix

Conversation

@travisrisner
Copy link
Contributor

Pull Request for Issue #44862

Summary of Changes

This pull request resolves a bug in the Media Action - Resize plugin where images are resized unnecessarily when only one dimension (width or height) is set.

Previously, if a user defined only a max width (e.g., 1920px) and left height unset, the plugin would still resize small images (e.g., 200px wide). This occurred because the height check defaulted to 0, incorrectly failing the comparison logic.

The logic has been updated to evaluate width and height independently. The plugin now only resizes if the image exceeds a defined constraint.

Testing Instructions

  1. Enable the plugin Media Action - Resize.
  2. Set Maximum Width to 1920. Leave Maximum Height empty.
  3. Upload a small image via Media Manager (e.g., 200x300px).
  4. Observe that before the patch, the image was resized unnecessarily.
  5. Observe that after the patch, the image is not resized if not necessary.
  6. Optionally test with only height set and both width and height set.

Actual result BEFORE applying this Pull Request

Images smaller than the defined max width or height are still resized if one constraint is not set.

Expected result AFTER applying this Pull Request

Images are only resized if they exceed a defined max width or height. Unset dimensions are ignored in the check, preventing unnecessary resizing.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed

Co-authored-by: Quy Ton <quy@nomonkeybiz.com>
@exlemor
Copy link

exlemor commented Apr 11, 2025

I have tested this item ✅ successfully on b9a54b0

I have tested this successfully (with both only height set and both width and height set). Thanks @travisrisner!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45311.

Co-authored-by: Quy Ton <quy@nomonkeybiz.com>
@QuyTon
Copy link
Contributor

QuyTon commented Apr 18, 2025

I have tested this item ✅ successfully on 09d2249


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45311.

1 similar comment
@alikon
Copy link
Contributor

alikon commented Apr 18, 2025

I have tested this item ✅ successfully on 09d2249


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45311.

@alikon
Copy link
Contributor

alikon commented Apr 18, 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45311.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 18, 2025
@richard67 richard67 enabled auto-merge (squash) April 19, 2025 14:29
@richard67 richard67 added this to the Joomla! 5.3.1 milestone Apr 19, 2025
@richard67 richard67 merged commit d87990a into joomla:5.3-dev Apr 19, 2025
3 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Apr 19, 2025
@richard67
Copy link
Member

Thanks all (author and testers).

richard67 added a commit to richard67/joomla-cms that referenced this pull request Apr 23, 2025
… Resize plugin (joomla#45311)

Fix issue joomla#44862 in the Media Action - Resize plugin where images are resized unnecessarily when only one dimension (width or height) is set.

The logic has been updated to evaluate width and height independently. The plugin now only resizes if the image exceeds a defined constraint.

---------

Co-authored-by: Quy Ton <quy@nomonkeybiz.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
@travisrisner travisrisner deleted the 5.3-dev-media-resize-plugin-fix branch April 23, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants