[4.2] Local adapter thumbnails#36552
Conversation
Co-authored-by: Brian Teeman <brian@teeman.net>
|
/me still waits for the day when there are no path issues in one of your pr
|
FWIW this is not the subfolder issue but me modifying the path string in a UNIX way (obviously fails for fat/ntfs) |
|
No its not a unixfs thing you are mixing up the JPATH_ROOT and the uri:root I doubt it would work on any filesystem JPATH_ROOT : C:\htdocs\joomla-cms |
|
@laoneo any thoughts here? |
|
still no joy |
|
I did something similar in DPMedia. But made resized only 10 images per request. The other ones I do serve with with a placeholder image. On large image folders it takes too much resources on shared hosting and ended up with broken thumbnails. |
|
PS if we have thumbnails do we still need lazyload? |
Yes, the thumbnails fix the bandwidth problem, the lazyloading fixes the UI responsiveness (eg view the file thumbs quicker). |
Please use Other thing: have to ensure a thumbnail exists (and create it if not) on request, not only while upload. |
It's already like that
The last time I've checked, Joomla clears the media cache but I can change it no debate here EDIT: @Fedik I switched the cache folder to |
Is that for the tests or on your local machine? |
|
@Quy fetch the latest changes and try again (it's hard to debug something that's not replicable locally) |
|
Sorry no go. Thumbnails are generated. Just missing / before the filename in the thumbnail URL. |
Signed-off-by: dgrammatiko <d.grammatiko@gmail.com>
|
It is ok in the main folder but not in subfolders. Missing / after banners folder.
|
Signed-off-by: dgrammatiko <d.grammatiko@gmail.com>
Co-authored-by: Quy <quy@fluxbb.org>
Signed-off-by: dgrammatiko <d.grammatiko@gmail.com>
| if (!is_dir(dirname($thumbPaths['fs']))) | ||
| { | ||
| mkdir(dirname($thumbPaths['fs']), 0755, true); | ||
| } |
There was a problem hiding this comment.
Can this be removed since it is checked/created here?
joomla-cms/libraries/src/Image/Image.php
Line 345 in 4de5af0
| { | ||
| $dir = JPATH_ROOT . '/media/cache/com_media/thumbs/' . $this->filePath; | ||
|
|
||
| if (!is_dir($dir)) |
There was a problem hiding this comment.
You need it only when you writing a thumbs, it does not need in constructor
|
|
||
| if (!is_dir(dirname($thumbPaths['fs']))) | ||
| { | ||
| mkdir(dirname($thumbPaths['fs']), 0755, true); |
There was a problem hiding this comment.
Please replace all use of mkdir() to Folder::create(), this will create a folder with all subfolders recursively.
|
@Quy @Fedik and everyone else involved here: first of all thanks for all the code reviews, feedback and testing but we're too late for 4.1... Thanks! ☮ |


Pull Request for Issue #36533 [Solves no 2 of the 3 reported problems, the thumbs ].
This is still a draft as it is missing the UI for regenerating the thumbs recursively (in the options of the local adapter)
Summary of Changes
Testing Instructions
Actual result BEFORE applying this Pull Request
Media manager loads a thumb
Expected result AFTER applying this Pull Request
Media manager Loads the full image
Documentation Changes Required
From a code point of view, the decision was to place the thumbs in a subfolder of the media folder called
cache_mmThe reason that I didn't reuse the existing
cachefolder is simple: Joomla cleans that folder on each update and we WANT the thumbs to persist on updates (they are static files so PHP/JS/CSS/db changes are largely irrelevant).