Images not visible from Media Library

No media are showing under Media library when preview in grid mode. If switching to list mode all media files appear again.

  • James Morris
    • WordPress Enthusiast

    Hello Roseann Mayer,

    I hope you are well today. I'll be following up with you regarding your chat.

    I took a deeper look into your site and I noticed something very strange. Looking at your Media Library in List Mode, I noticed you had 19 instances of a file with the name (no title) - Logo, but none of these instances had an Author or ID associated with them.

    I logged into your server and checked phpMyAdmin with the following SQL query:

    SELECT * FROM wp_posts WHERE ID = '0' AND post_type = 'attachment'

    Sure enough, this returned exactly 19 records, which directly corresponds with the number of broken images in the Media Library.

    I made a backup of your site's database to {DBname}_backup and performed a query to remove those records that did not have the correct ID associated with them. To clarify, the ID should always be > 0 and should always be unique. This is why the images were not displaying correctly in your Media Library.

    After performing the above, I switched to Grid View in your Media Library and everything is working correctly now.

    Let us know if you have any further questions. We'll be happy to help! :slight_smile:

    Best regards,

    James Morris

  • Roseann Mayer
    • WPMU DEV Initiate

    OK - so this morning, I re-smushed the 703 images, got the message that they had smushed (3rd time I've done this and same message appeared) HOWEVER, NOTHING SMUSHED and my media library is back to LIST ONLY - grid was there BEFORE THE SMUSH. Can you help?

  • James Morris
    • WordPress Enthusiast

    Hello Roseann Mayer,

    I've take a closer look at your site and I'm seeing some things that are, well... very concerning.

    In the process of troubleshooting the Smush issue, I found that there was a DB error being thrown about a duplicate entries in the primary column. I did some more digging and found the following.

    Your wp_posts and wp_postmeta tables were altered sometime in the past to remove the AUTO_INCREMENT attribute on the ID and meta_id columns. This cannot happen accidentally because, when WordPress creates the database tables, AUTO_INCREMENT is set. This has to be removed intentionally.

    I was able to ALTER the wp_postmeta table and get Smush to run, but it was after that I discovered the issue with the wp_posts table. Due to the relationship between these 2 tables, trying to run a site where the relationship between IDs (the primary key column the relationship between these tables is built on) is compromised is dangerous. All kinds of data corruption can happen.

    In order for me to "fix" the wp_posts table, I would have to delete a large number of post entries where the ID = 0. These are not posts, but are setting entries for plugins like nextgen gallery. Then I would have to ALTER the ID column to make it AUTO_INCREMENT. This is doable, but there very well could be data loss. Also, since the data is already compromised from running with the two tables not having AUTO_INCREMENT properly set on their primary key columns, there's a very good chance that there could be further data corruption.

    The best recommendation would be to fall back to a backup that was made prior to these problems surfacing. For instance, if you had someone work on the site before me, restore to the backup made prior to their work. Then, check the tables to ensure that AUTO_INCREMENT has been set through phpMyAdmin.

    To check if the columns are properly set to AUTO_INCREMENT, go into phpMyAdmin, click your database name, click the table name you wish to check, then click the Structure tab.

    Screenshot: https://i.imgur.com/fhK7zzg.png

    If you do not have a backup prior to when these problems surfaced, then your best course of action is to use the native WordPress Export/Import tools to export your existing content. Then, setup a fresh install of WordPress and import the content from there and rebuild your settings from there.

    This is a very unfortunate situation because it's going to take a bit of work on your end to recover from. But, unfortunately, when something/someone alters the database in this way, it causes a multitude of problems that are not simple to recover from. And without knowing exactly when this happened, it only further complicates the matter.

    Let me know if you have any further questions. I'll be happy to help!

    Best regards,

    James Morris

  • Roseann Mayer
    • WPMU DEV Initiate

    Good morning and THANK YOU for your awesome tech support. I think we have the problems that you mention above fixed. HOWEVER - a GTMetrix score is still showing that I have uncompressed images and I would like to know how to fix this PLUS, my carousel images are not showing up when a visitor enters the site, just below the header image and other carousel on HOME page when you first open the site - can you help me with this?

  • James Morris
    • WordPress Enthusiast

    Hello Roseann Mayer,

    I see you were able to get the carousel image issue resolved. Great! :slight_smile:

    RE: GTMetrix...

    If you go to WP Admin -> Media -> WP Smush, you'll see there are several other options available to you for image optimization. Enabling these options and clicking Re-check Images will yield several more images that can be compressed using Smush. This should significantly improve your image score on GTMetrix.

    I hope this clarifies a bit. Let us know if you have any further questions. We'll be happy to help! :slight_smile:

    Best regards,

    James Morris

  • Roseann Mayer
    • WPMU DEV Initiate

    We have a problem with the Hummingbird plugin - when active it doesn't allow the Carousel slideshow nor the menu dropdown on the HOME page - we have deactivated the plugin in order to keep everything in working order. Can you check out any conflicts and advise?

  • James Morris
    • WordPress Enthusiast

    Hello Roseann Mayer,

    This type of symptom is almost always due to the Minification feature in Hummingbird. Basically, some CSS and JavaScript (JS) files do not play well being minified, combined, relocated or deferred. This isn't an issue with the plugin as much as a limitation of the languages and how they are written.

    The way to troubleshoot this is:
    - Enable the Minification module
    - Bulk disable minification, combining, relocation and deferring for all CSS/JS files
    - Enable 1 file at a time, then test
    - Continue to add another file and save then test again

    This is a little time consuming, but doing this ensures you are only optimizing assets that are compatible and will ensure that you achieve maximum performance.

    I hope this clarifies a bit. Let us know if you have any further questions. We'll be happy to help. :slight_smile:

    Best regards,

    James Morris

  • Roseann Mayer
    • WPMU DEV Initiate

    Hi James - we're STILL having problems - my developer followed your instructions above and the only way we seem to be able to resolve the issue of the HOME PAGE carousel slider working and the drop down menu to work (it's working on the other pages of the site) is to deactivate Hummingbird completely - any other suggestions or help will be greatly appreciated.

  • Roseann Mayer
    • WPMU DEV Initiate

    And here's the real thing - right now it's working correctly with Hummingbird activated - 10 minutes from now (or at odd times) it goes back to being broken, this is where the developer is pulling his hair out and pocketbook is draining having him chase this down. Thanks in advance for your help.

  • Roseann Mayer
    • WPMU DEV Initiate

    What I meant to say was this - it works fine on the HOME page from within the dashboard, but when you check it on any browser the HOME page carousel slider and DROP DOWN top line menu do not work - when you click on one of the top line menu items in any browser and go to a page, the carousel slider is working, and the top line menu drop down too - HOWEVER, when you hit HOME, you go back to the broken page.

  • Roseann Mayer
    • WPMU DEV Initiate

    Now, in any browser, NONE of the top line drop down menus are working - I am going to deactivate Hummingbird until you guys can take a look into the problem. We rolled the site out to over 8,000 prospects in the past 72 hours and you can imagine what kind of user experience they have had - not good.

  • James Morris
    • WordPress Enthusiast

    Hello Roseann Mayer,

    I've taken a closer look at your site and I believe I've found the source of the problem.

    Your site had Endurance Page Cache installed as a mu-plugin and set to level 2 caching. This was conflicting with Hummingbird.

    I set the caching level to 0 to disable the plugin.

    Also, there was a Facebook script that was incorrectly setup on the site which was causing a JS Script error. This can cause improper parsing of other JavaScript files. I added a closing </script> tag to resolve the JS Console error related to this.

    I then enabled Hummingbird and Minification. I accepted the default settings of Minification and tested your site. The Navigation and carousel slider are both working correctly.

    Can you please test and confirm this is working correctly for you?

    NOTE: For future reference...

    It's always best to keep tickets limited to one topic and one plugin. This helps us to keep threads manageable and it also helps other members find information more efficiently. :slight_smile:

    Best regards,

    James Morris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.