WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

  • Clicking on "Edit" brings you to the "Edit Media" page, but NO image is displayed.

  • Copying the file URL in the "Save" area on the right side of the "Edit Media" page and pasting it into the browser address bar DOES show the image.

  • Clicking "View" from the "Media Library" brings you to a page, but NO image is displayed.

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.

share|improve this question
2  
Install Firebug (or something similar) and right click the missing image. Look at the url that is failing. How does it differ from other urls that are working for the same image size? – Charles Clarkson May 12 '13 at 11:55
    
You say the files upload correctly, which makes permissions problems less likely, but you might want to look over wordpress.stackexchange.com/questions/96408/… anyway. – s_ha_dum May 12 '13 at 15:08
    
Hi, thanks for the replies. The URL doesn't differ and none of the images are showing regardless of size. Here is one of the post with photos appearing as links only. Clicking on the link brings up the image so its in the right directory, but it doesn't show up in the post itself or in the library. – MasterKong Jun 4 '13 at 13:52
    
Could it be that the image resolution is too large, and its causing the browser to not display the images as it would crash the browser? Currently I'm having an issue where images which I uploading using media_handle_upload were too large for WP to create thumbs of them, thus when looking at the media library it would try and display several 2M images and crash the browser. Not sure if this is the same issue, but might help. – Nick M Oct 23 '14 at 2:05
    
Potential duplicate of wordpress.stackexchange.com/questions/130917/… – Nick M Oct 23 '14 at 2:15

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.