-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.3] Local adapter thumbnails (PR 36552 clone) #38805
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
Conversation
Updated thumbnails creation function
Added thumbs to the adapter
Added thumbs field (defaults to true)
Commented out lines in testUpdateFileWithoutAdapter
Added thumbs and thumbSize properties Updated construct, createFile, updateFile, delete, getPathInformation, rglob, checkContent Added getLocalThumbPaths, getThumb, createThumb functions
tab removal
Removed blank space
Replaced all use of mkdir() to Folder::create()
|
tests/Codeception/api/com_media/MediaCest.php needs to be updated and fails at this point. |
|
Hey, @obuisard I can't reply on #38722 as Nik has blocked me so I'll write my comment here:
|
|
Thank you Dimitris @dgrammatiko. I did address the first review, fixed formatting and tested the code successfully. As far as the tests are concerned, a solution would be to remove testUpdateFileWithoutAdapter all together, but I would appreciate someone's expertise on this. |
@laoneo could you advise here? |
|
Removing the test is a bad idea. Better to set the default to 0, so no thumbs will be generated and the admin has to activate it. If it is on by default, then after the update all thumbnails are generated without notice, which can lead to resource issues on large sites. |
By default, thumbnails are not created
Default the creation of thumbnails to 'no'
|
I have modified the code to make the thumbnail creation 0 by default. It does solve issues with tests. Thank you @laoneo for the suggestion. |
Removed the creation of the folder since it is addressed in libraries/src/Image/Image.php as suggested by @Quy in the previous PR
|
I have tested this item ✅ successfully on 53bc63a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38805. |
|
I have tested this item ✅ successfully on 53bc63a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38805. |
thumb_path should not have been renamed
Added the deprecation on createThumbs
changed deprecated version number
|
I have tested this item ✅ successfully on d82abd9 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38805. |
|
I have tested this item 🔴 unsuccessfully on d82abd9 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38805. |
That's strange. The thumbnails created with the PR should be 200x200. |
Oh good catch Dimitris @dgrammatiko! @N6REJ can you double-check? Thank you! |
|
Thank you, Troy @N6REJ for reporting those issues. |
|
I have tested this item ✅ successfully on d82abd9 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38805. |
|
A big thank you to Dimitris @dgrammatiko and the testers ! |
|
Documentation added ✔️ |
|
@obuisard I haven't checked but is the thumbnails functionality bypasses the svg files? If not it needs to do so, the thumbs helper expects only files that the Image class can handle. I'll try to check the next days if I get some free time |
@dgrammatiko I have checked SVG and image thumbnail creation and both work well together. The |
|
it's sad that we are using GD instead of imagemagick. |
I know, but GD is more widely installed than imagick. It would be great to offer the use of either one of those graphic libraries in Joomla. |
|
You'll be surprised but GD (PHP 8.1+) is (median) faster than imagick. How do I know? I keep testing these for responsive-images |
|
@dgrammatiko faster but I thought imagick quality was far higher? |







Summary of Changes
This Pull Request is for issue #36533 [Solves no 2 of the 3 reported problems, the thumbs] and is a rewrite for #36552 created by @dgrammatiko.
Please refer to the original PR if you want to follow the discussions about the implementation.
The general idea is that image thumbnails are created in the Media Manager and those thumbnails are cached, increasing performance especially when a large amount of images is processed.
The thumbnail creation is 'off' by default.
Testing Instructions
Go to the FileSystem - Local plugin and set 'Create thumbnails' to 'Yes' on the 'images' folder.
Actual result BEFORE applying this Pull Request
The media manager loads full size images.
Expected result AFTER applying this Pull Request
The media manager loads a thumbnail image (max width or height of 200px).
Link to documentations
Please select:
Documentation link for docs.joomla.org: https://docs.joomla.org/Chunk4x:Extensions_Plugin_Manager_Edit_FileSystem_Group
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org: Update new-deprecations.md for Image Manual#59
No documentation changes for manual.joomla.org needed