Skip to content
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

[4.x]: Asset Thumbnails not Reliably Appearing in Control Panel Asset, Entry and Entries Listing Pages #11350

Closed
richhayler opened this issue May 31, 2022 · 5 comments

Comments

@richhayler
Copy link

richhayler commented May 31, 2022

Description

Asset thumbnails are not reliably appearing for all entries within the control panel (e.g. entry page, entries listing and assets section) despite the transforms existing for these in the relevant folder.

Using the web inspector I have checked the data-srcset links to the asset thumbnails in the control panel and have verified these exist (I can open the image in a seperate browser tab). It seems it may have something to do with asset file names that contain a space.

CleanShot 2022-05-31 at 11 42 43@2x

Steps to reproduce

If images have originally been uploaded via FTP (instead of via the control panel) and contain spaces in the filename it seems these thumbnails are not being displayed in the control panel. Despite the thumbnails existing (following asset indexing being run via CP utilities to pick up these files).

I can see that when an asset is uploaded via the control panel Craft by default converts the file to lower case and replaces spaces with a hyphen (kebab case). It would be nice to have a console cmd to convert all uploaded files to lower case kebab. Some thing like: https://craftcms.com/docs/4.x/config/config-settings.html#convertfilenamestoascii

For example the following thumbnail is not being displayed:
/_34x34_crop_center-center_none/Barefoot Sunset.jpg 34w

But this one is being displayed:
/_34x34_crop_center-center_none/Bayside.jpg

asset-thumbnails

CleanShot 2022-05-31 at 11 41 58@2x

Craft CMS version

4.0.3

PHP version

8.1

@richhayler
Copy link
Author

richhayler commented May 31, 2022

If I edit the asset via the control panel and replace the space with a hyphen the thumbnail is correctly shown.

CleanShot 2022-05-31 at 11 45 29@2x

It's also worth noting that if I try to edit the file name of an asset via the control panel to add a space between characters, I will get an error stating "the asset could not be saved"

It would be nice if Craft automatically removed spaces from asset filenames and replaced them with hyphens when running "asset indexing".

@richhayler richhayler changed the title [4.x]: Asset Thumbnails not Reliably Appearing in Control Panel Entry / Entries Pages [4.x]: Asset Thumbnails not Reliably Appearing in Control Panel Asset, Entry and Entries Listing Pages May 31, 2022
@brandonkelly
Copy link
Member

Are you getting any JavaScript errors, or are there any requests listed in your browser’s Resources tab that aren’t completing?

@richhayler
Copy link
Author

richhayler commented Jun 1, 2022

No javascript errors. Could it simply be that Craft is not URL encoding the http path to the thumbnail image and replacing spaces with %20 and this is why they are not displaying within the CP?

For example this is what Craft is referencing for one of the thumbnails that is not displayed:

https://hayler.com/uploads/transforms/art/_68x68_crop_center-center_none/Elwood Breeze.jpg

and should be

https://hayler.com/uploads/transforms/art/_68x68_crop_center-center_none/Elwood%20Breeze.jpg

If I add the %20 using the inspector in the browser then the thumbnail appears.

@brandonkelly
Copy link
Member

Sorry, yeah, able to reproduce locally. Just got this fixed for the next release!

@brandonkelly
Copy link
Member

Craft 4.0.4 is out now with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants