User tests: Successful: Unsuccessful:
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.
Enable Create Thumbnails in Filesystem - Local, upload a 1000×2 image (or 2×1000), and open that folder in the Media Manager.
The ValueError is thrown and the folder doesn't list, e.g.
imagecreatetruecolor(): Argument #2 ($height) must be greater than 0
The folder lists and a thumbnail of 200×1 is generated for the image.
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
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Title |
|
||||||
| Labels |
Added:
PR-5.4-dev
|
||