Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 5.3-dev
Choose a base branch
from

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

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants