PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar ryandemmer
ryandemmer
5 Oct 2026
  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

This issue was discovered in the Media Manager when the Create Thumbnails option is enabled in the Filesystem - Local plugin, and the folder contains an image with an extreme aspect ratio, e.g. 1000×2, 1920×4 or 2×1000.

LocalAdapter::createThumbnail() calls Image::createThumbnails() with SCALE_INSIDE, which goes through Image::resize() and Image::prepareDimensions().

When the shorter side is divided by the scale ratio in Image::prepareDimensions() and the result is below 0.5, it rounds to 0. That 0 is passed to imagecreatetruecolor(), which throws a ValueError and stops the Media Manager listing when thumbnails are enabled.

The same applies to any Image::resize() call using SCALE_INSIDE, SCALE_OUTSIDE or SCALE_FIT.

This change ensures that the width and height calculated by prepareDimensions() are at least 1px.

Testing Instructions

Enable Create Thumbnails in Filesystem - Local, upload a 1000×2 image (or 2×1000), and open that folder in the Media Manager.

Actual result BEFORE applying this Pull Request

The ValueError is thrown and the folder doesn't list, e.g.

imagecreatetruecolor(): Argument #2 ($height) must be greater than 0

Expected result AFTER applying this Pull Request

The folder lists and a thumbnail of 200×1 is generated for the image.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar ryandemmer ryandemmer - open - 5 Oct 2026
avatar ryandemmer ryandemmer - change - 5 Oct 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Oct 2026
Category ⇒ Libraries
avatar ryandemmer ryandemmer - change - 5 Oct 2026
Title
…
Image: prevent zero width or height when resizing with extreme aspect ratios
[AI] Image: prevent zero width or height when resizing with extreme aspect ratios
avatar ryandemmer ryandemmer - edited - 5 Oct 2026
avatar ryandemmer ryandemmer - change - 5 Oct 2026
The description was changed
avatar ryandemmer ryandemmer - edited - 5 Oct 2026
avatar ryandemmer ryandemmer - change - 5 Oct 2026
Labels Added: PR-5.4-dev

Add a Comment

Login with GitHub to post a comment