? Language Change ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
3 Jan 2022

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

  • Generate thumbs for the Media manager

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_mm
The reason that I didn't reuse the existing cache folder 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).

avatar dgrammatiko dgrammatiko - open - 3 Jan 2022
avatar dgrammatiko dgrammatiko - change - 3 Jan 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Jan 2022
Category Front End Plugins
avatar dgrammatiko dgrammatiko - change - 3 Jan 2022
Labels Added: ?
32e830b 3 Jan 2022 avatar dgrammatiko CS
avatar brianteeman
brianteeman - comment - 3 Jan 2022

/me still waits for the day when there are no path issues in one of your pr

<div class="image-cropped" style="background-image: url(&quot;http://localhost/joomla-cms/C:/htdocs/joomla-cms/images/sampledata/parks/landscape/120px_pinnacles_western_australia.jpg?1641240738875&quot;);"></div>

avatar dgrammatiko
dgrammatiko - comment - 3 Jan 2022

/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)

avatar brianteeman
brianteeman - comment - 3 Jan 2022

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
Uri::root() : http://localhost/joomla-cms/

6fa87d4 3 Jan 2022 avatar dgrammatiko cs
4d809d3 3 Jan 2022 avatar dgrammatiko Cs
419f3c4 3 Jan 2022 avatar dgrammatiko go
avatar dgrammatiko
dgrammatiko - comment - 3 Jan 2022

@laoneo any thoughts here?

avatar brianteeman
brianteeman - comment - 3 Jan 2022

still no joy

avatar laoneo
laoneo - comment - 3 Jan 2022

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.

86b12aa 3 Jan 2022 avatar dgrammatiko meh
f625e4b 3 Jan 2022 avatar dgrammatiko meh
0c7c523 3 Jan 2022 avatar dgrammatiko meh
avatar brianteeman
brianteeman - comment - 3 Jan 2022

the thumbnails are now created and used

think you need to check the code that creates the thumbnails as the dimensions are ok but the files are big - some are even bigger than the original

image

avatar brianteeman
brianteeman - comment - 3 Jan 2022

PS if we have thumbnails do we still need lazyload?

avatar dgrammatiko
dgrammatiko - comment - 3 Jan 2022

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).
Still the pagination or streaming is missing to fix the enormous lists (the actual number might not be that big on a cheap server). As I said this is a 3 fold problem...

avatar joomla-cms-bot joomla-cms-bot - change - 4 Jan 2022
Category Front End Plugins Administration Language & Strings Front End Plugins
avatar Fedik
Fedik - comment - 4 Jan 2022

The reason that I didn't reuse the existing cache folder

Please use /media/cache/com_media as cache.
On update Joomla will clear a root /cache and should not clear /media/cache, otherwise it a bug to me.

Other thing: have to ensure a thumbnail exists (and create it if not) on request, not only while upload.
This way it will be easy to refresh whole cache in case of any failure.

avatar dgrammatiko
dgrammatiko - comment - 4 Jan 2022

Other thing: have to ensure a thumbnail exists (and create it if not) on request,

It's already like that

otherwise it a bug to me.

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 'media/cache/com_media/thumbs/' . $this->filePath where $this->filePath is the local adapter, eg images.
Someone needs to confirm that Joomla is not emptying the media/cache folder on updates otherwise this is completely wrong, an update should not invalidate the thumbnails...

avatar dgrammatiko dgrammatiko - change - 4 Jan 2022
Labels Added: Language Change
avatar dgrammatiko
dgrammatiko - comment - 4 Jan 2022

Feedback is welcome here (especially if you have a huge images folder to test it against)

666be48 9 Jan 2022 avatar dgrammatiko CS
avatar Quy
Quy - comment - 12 Jan 2022

The thumbnails are blurry. The PNG looses transparency.

36552

avatar joomla-cms-bot joomla-cms-bot - change - 13 Jan 2022
Category Front End Plugins Administration Language & Strings Administration Language & Strings Libraries Front End Plugins
4fba529 13 Jan 2022 avatar dgrammatiko oops
avatar dgrammatiko
dgrammatiko - comment - 13 Jan 2022

The thumbnails are blurry. The PNG looses transparency.

@Quy both should be fixed now
@laoneo can you shed some light why the API tests fail here?

avatar laoneo
laoneo - comment - 13 Jan 2022

On ?, but I guess it is a CS issue

avatar dgrammatiko
dgrammatiko - comment - 13 Jan 2022

On ?, but I guess it is a CS issue

Hmm, not really, the no adapter test fails with these changes but I couldn't figure out why by looking at the tests (didn't debug)

d3998c3 13 Jan 2022 avatar dgrammatiko CS
avatar laoneo
laoneo - comment - 13 Jan 2022

500 errors are hard to figure out, had the same issue with the web service pr. It was a folder permission thing at that time.

avatar Quy
Quy - comment - 13 Jan 2022

Uploading results in The image file does not exist. as if the uploading failed. However, refreshing the page shows the image.
The thumbnail is still blurry.

http://localhost/Joomla_4.1.0-dev-pr.36552-Development-Full_Package/administrator/index.php?option=com_media&format=json&mediatypes=0,1,2,3&task=api.files&path=local-images:/

[HTTP/1.1 500 Internal Server Error 201ms]

Testing locally on Windows with XAMPP.

avatar dgrammatiko
dgrammatiko - comment - 13 Jan 2022

Uploading results in The image file does not exist. as if the uploading failed. However, refreshing the page shows the image.

What's the background-image URL for the missing thumbnail?

The thumbnail is still blurry.

The thumbnails size is configurable (not sure if I added the form options but the rest of the code is there) but generally speaking the thumbs should be small so a bit of blurriness might be acceptable (personal opinion)

avatar Quy
Quy - comment - 13 Jan 2022

The thumbnail URL is fine. It is the error message that is displayed after uploading.

avatar dgrammatiko
dgrammatiko - comment - 13 Jan 2022

@Quy my bad, copy/pasted the wrong var

avatar Quy
Quy - comment - 13 Jan 2022

The thumbnails size is configurable (not sure if I added the form options but the rest of the code is there) but generally speaking the thumbs should be small so a bit of blurriness might be acceptable (personal opinion)

The blurriness is due to the thumbnail at 100px and stretched/pixelated at zoom 2 (194px). So maybe make the default thumbnail be 200x200?

zoom 1 (min) = 141px
zoom 2 (default) = 194px
zoom 3 = 298px
zoom 4 (max) = 612px

avatar dgrammatiko
dgrammatiko - comment - 13 Jan 2022

@Quy ok now it's 200x200

avatar Quy
Quy - comment - 13 Jan 2022

Uploading a .txt file displays this message Unable to get properties for the image..
Deleting an image does not delete its thumbnail.

avatar Quy
Quy - comment - 16 Jan 2022

Do a fresh install.
Go to Media.
No images displayed.
Go to /media/cache/com_media/thumbs/images
No images created.
Same as uploading new images.

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

@Quy what are your options in the Filesystem plugin? Are thumbnails enabled?

Anyways the No images displayed. is a bug but can't replicate it locally (probably another fat/ntfs thing)

avatar Quy
Quy - comment - 16 Jan 2022

It was working prior to last changes. No thumbnails are generated thus no thumbnails to display.

no-images

avatar Quy
Quy - comment - 16 Jan 2022

It works with new/edit images, but not existing images.

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

It works with new/edit images, but not existing images.

If you refresh the page the images appear? Is this some sort of race condition?

avatar Quy
Quy - comment - 16 Jan 2022

On a clean install, thumbnails are not generated. Uploading/editing images create thumbnails. The issue is with the initial installation.

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

The issue is with the initial installation.

What are the URLs for the background-image on the missing images?

avatar Quy
Quy - comment - 16 Jan 2022

There are no thumbnails generated in /media/cache/com_media/thumbs/images with the initial installation.

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

@Quy I meant this url:
Screenshot 2022-01-16 at 20 45 08

avatar Quy
Quy - comment - 16 Jan 2022

http://localhost/Joomla_4.1.0-dev+pr.36552-Development-Full_Package/media/cache/com_media/thumbs/images/joomla_black.png?1642363706467

Nope.
No thumbnails generated in the /media/cache/com_media/thumbs/images.

I can upload a new image and thumbnail is generated.

new-upload

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

@Quy should be ok now, I used a node function name instead of a PHP one...

avatar Quy
Quy - comment - 16 Jan 2022

Sorry it is still a no go. :(

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

@Quy what about now?

avatar Quy
Quy - comment - 16 Jan 2022

Nothing is displayed.

nothing

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

Nothing is displayed.

We're making progress... ?

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

@bembelimen can you give a verdict on this one? Is it something that you're interested in for 4.1?

If so someone needs to help me with the API tests failures here

avatar Quy
Quy - comment - 16 Jan 2022

Missing / before the filename.

http://localhost/Joomla_4.1.0-dev+pr.36552-Development-Full_Package/media/cache/com_media/thumbs/imagesjoomla_black.png?1642367942093

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

Missing / before the filename.

Is that for the tests or on your local machine?

avatar Quy
Quy - comment - 16 Jan 2022

Testing locally with a new install.

missing-slash

avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2022

@Quy fetch the latest changes and try again (it's hard to debug something that's not replicable locally)

avatar Quy
Quy - comment - 16 Jan 2022

Sorry no go. Thumbnails are generated. Just missing / before the filename in the thumbnail URL.

avatar Quy
Quy - comment - 16 Jan 2022

It is ok in the main folder but not in subfolders. Missing / after banners folder.

http://localhost/Joomla_4.1.0-dev+pr.36552-Development-Full_Package/media/cache/com_media/thumbs/images/bannersosmbanner1.png?1642371757494

avatar joomla-cms-bot joomla-cms-bot - change - 16 Jan 2022
Category Front End Plugins Administration Language & Strings Libraries Administration Language & Strings Libraries Front End Plugins Unit Tests
avatar dgrammatiko dgrammatiko - change - 16 Jan 2022
Labels Added: ?
avatar dgrammatiko
dgrammatiko - comment - 17 Jan 2022

@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...
This needs to be postponed to 4.2 or if the maintainers feel that it could go on a patch on a 4.1.x
That said I won't be the one driving this feature so feel free to fork the work done here and patch anything still missing, buggy, etc

Thanks!

avatar richard67 richard67 - change - 1 Feb 2022
Title
[4.1] Local adapter thumbnails
[4.2] Local adapter thumbnails
avatar richard67 richard67 - edited - 1 Feb 2022
avatar richard67 richard67 - change - 1 Feb 2022
Labels Added: ?
Removed: ?
avatar dgrammatiko dgrammatiko - change - 3 Feb 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-02-03 15:24:14
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - close - 3 Feb 2022

Add a Comment

Login with GitHub to post a comment