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

Some thumbnails in WordPress Media Library are showing as 1x1 pixel - short-term fix #37

Closed
mrengy opened this issue Nov 12, 2022 · 1 comment · Fixed by #96
Closed
Assignees
Labels
bug Something isn't working CSS good first issue Good for newcomers javascript

Comments

@mrengy
Copy link
Owner

mrengy commented Nov 12, 2022

Some, but not all thumbnail images in the Media Library are showing with width="1" height="1" in the <img> tag. This obviously makes them basically invisible. I'm not sure why this has happened and if it will continue to be an issue with some new uploads. It's something to explore separately

1x1-thumbnail example

As a short-term fix for this, create a script to find those 1x1 thumbnail images and set them to the size of the other ones that are correct, which is either going to be 64 x 64 or 60 x 60, or maybe something else, depending on the page in the WP Admin. Ideally set it based on observed size values of the other thumbnails on the page rather than hardcoding it.

Script should run only on WordPress Admin pages - so as to not slow down the front end. In order to do this, you'll want to create a new JS file and then on functions.php under the "enqueue scripts and styles" comment, enqueue the script using admin_enqueue_scripts.

Notes:

The site is using a plugin to enhance the media library, so you should view the media library from the prior link or navigate there under "Media" > "Assistant" rather than the usual way in WordPress.

The table formatting on the "Media" > "Library" page is messed up because of some other very narrow columns. Don't worry about that with this ticket.

@mrengy
Copy link
Owner Author

mrengy commented Jan 28, 2023

This was blocking a step I have to do to build in pagination, so I took care of it first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CSS good first issue Good for newcomers javascript
Projects
None yet
2 participants