Support » Fixing WordPress » Media Library images missing

  • 1) This site migrated recently + many images had to be manually cloned from a CDN using wget to pull images off CDN into correct uploads directory.

    2) All permissions set correctly…

    find wordpress -type d -print0 | xargs -0 chmod 755
    find wordpress -type f -print0 | xargs -0 chmod 644

    3) All ownership set correctly…

    chown -hR www-data:www-data wordpress

    4) Images exist on the disk.

    5) If an image is selected in the Media Library, then edited image appears correctly in edit pane.

    6) Directly viewing image in a browser works correctly.

    7) Only problem seems to be some requirement to regenerate the Media Library image previews.

    8) I thought about doing the following…

    wp-cli media regenerate –skip-delete –only-missing

    And this wp-cli command seems to only deal with regenerating thumbnails, not media preview images.

    9) Someone let me know how to refresh all the media images.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter David Favor

    (@dfavor)

    Note: Many images, the ones in the originally restored site backup, all show up correctly in the Media Library preview.

    Only images missing from original backup have this problem.

    If it’s the various additional sized iamges that are missing, about the best thing ot use is Regenerate Thumbnails. That will do exactly as it’s title says.

    Thread Starter David Favor

    (@dfavor)

    Solved.

    The problem is with Pressable hosting (which I recommend against).

    They move all assets off to some private CDN, so assets fail to show up in actual site wp-content/uploads/XXXX/XX directories.

    This includes both served image (one file) + Media Library preview image (completely different file).

    Fix sequence for this problem, which likely occurs with other broken hosting companies too.

    1) Extract all page/post slugs from database.

    2) Visit each slug using PhantomJS, which runs all .css + .js, triggering access of many hidden assets.

    Note: If there are many assets requiring login access, PhantomJS invocations must be doctored up to simulate a login.

    3) At this point the Apache log will show 404s for all missing assets.

    4) Then craft wget/curl requests to pull all assets from CDN into correct …/wp-content/uploads/XXXX/XX directories.

    Brutal.

    Big Tip: For any site owner, when choosing hosting.

    First activity you should do when migrating to new hosting is to make a backup + restore your backup to another URL (so for foo.com maybe dev.foo.com or some other host).

    Then verified the restored site works.

    If you can’t make a backup or restore fails to produce a fully working site, then best drop your new hosting immediately + move keep moving hosting till you can generate a working backup/restore.

    Thread Starter David Favor

    (@dfavor)

    Note: Regenerate Thumbnails only regenerates images.

    This misses all other assets – PDF files, audios, videos, data files.

    Hi David,

    Bradly from Pressable support here!

    In Pressable ticket #138680, your colleague provided us a link to one of those assets over the CDN, and subsequently we were able to locate that asset on the file server. We also located the same asset in the backup that we provided you.

    Pressable provides backups to customers on a daily basis without issue. However, if there’s an issue that we can reproduce with any of the backups, we’ll be happy to look into it. In this case, please send us the file names in question via email: help[@]pressable.com.

    Thank you! 🙂

    Best,

    Bradly M. Hale
    Pressable Customer Success

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Media Library images missing’ is closed to new replies.