mrengy / vanguard-history

History site for the Santa Clara Vanguard
GNU General Public License v3.0
0 stars 0 forks source link

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

Closed mrengy closed 1 year ago

mrengy commented 1 year ago

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 commented 1 year ago

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