Getting blank thumbnails in media library?

I run a Multisite installation with 10 blogs. All the other blogs work fine except for one where any image that’s uploaded does not show up in the media library. There’s just a blank image instead of the usual thumbnail.

I can’t figure this out because this blog was installed the same way the others were.

I have made sure that:

  1. File permissions are set to 755 on all folders and files
  2. The images are uploading to the correct folder wp-content/uploads/sites/”site folder”/”year”/”month”
  3. Deactivated all plugins and reactivated each one to see if any are causing issues
  4. Uninstalled and reinstalled the particular blog.

The only thing I haven’t tried was doing something in the database directly, but don’t know where to start.

Related posts

1 comment

  1. I had a very similar problem, on a multisite with 8 blogs (2 of them).

    In my case I discovered that the the meta_value “_wp_attachment_metadata” of some images were corrupted in the table wp_xx_postmeta. It probably happened due to some plugin, because the last thing I did before this issue was to remove several unused plugins. But reinstalling them didn’t solve it…

    In a short, I recovered the meta_value(s) from an old database backup
    that had the correct values.

    Here is what I did:

    0 – First of all, I imported the SQL file of the OLD database into a separate database, in order to use both databases in the MySQL server at the same time.

    1 – Selected the IDs of all attachments in wp_xx_posts from the old database

    SELECT * FROM wp_xx_posts where post_type='attachment';
    

    where “xx” is the number of the blog with problem.

    2 – Selected all meta_id and meta_value in wp_xx_postmeta for the attachments from the old database:

    Select meta_id, meta_value from wp_xx_postmeta where meta_key = '_wp_attachment_metadata' and (post_id = 111 or post_id = ...);
    

    For all image IDs. By copying/ pasting/ replacing the data between an Excel spreadsheet and the notepad it’s easy to create the query for all IDs.

    3 – Created a SQL file with the updates of wp_xx_postmeta to be imported to the CURRENT database. This file might be a little bit large, and each line would be something like:

    UPDATE wp_xx_postmeta set meta_value = 'a:5:...a large serialized bunch of data' WHERE meta_id = 111;
    UPDATE wp_xx_postmeta set ...
    

    For all images. Again using Excel/ notepad.

    4 – Then I executed the SQL file using mysql -u root -p current_database < sqlfile.sql

    When I reloaded the site, all thumbnails and all images were working properly on the media library.

Comments are closed.