WordPress.org

Forums

Attachments metadata table gone: how to rebuild media library? (wp_postmeta) (9 posts)

  1. Filippo
    Member
    Posted 1 year ago #

    (I thought I posted this an hour ago but I can't find it!)

    One of the tables went missing from my database is wp_postmeta

    The most useful pieces of information are _wp_attached_file and _wp_attachment_metadata

    What still works:
    - Thumbnails and embed images are still visible because they link directly to the files and all the images are safely stored on my server
    See screenshot here
    - If I use Add Media I can see a preview of all the images
    See screenshot here

    What doesn't work:
    - On Add Media, although previews are visible, if I click on it there's no information as per size of the image. If I click on "Edit Image" this message comes up "Image data does not exist. Please re-upload the image."
    See screenshot here
    - If I open Media -> Library -> All the images are listed as usual but the preview is missing and so the information. Images can't be edited
    See screenshot here
    - I tried to rebuild thumbnails or use plugins as Fix My Posts but they don't work.
    See screenshot here

    What is missing?
    I reuploaded one image and these are the elements missing for all the over 65,000 images on the server.

    (559366, 166644, '_wp_attached_file', '2014/05/4660428211.jpg'),
    (559368, 166644, '_wp_attachment_metadata', 'a:6:{s:5:"width";i:594;s:6:"height";i:396;s:4:"file";s:22:"2014/05/4660428211.jpg";s:5:"sizes";a:4:{s:9:"thumbnail";a:5:{s:4:"file";s:22:"4660428211-150x100.jpg";s:5:"width";i:150;s:6:"height";i:100;s:9:"mime-type";s:10:"image/jpeg";s:20:"ewww_image_optimizer";s:51:"Reduced by 8.1% (329 B) - Previously Optimized";}s:6:"medium";a:5:{s:4:"file";s:22:"4660428211-300x200.jpg";s:5:"width";i:300;s:6:"height";i:200;s:9:"mime-type";s:10:"image/jpeg";s:20:"ewww_image_optimizer";s:51:"Reduced by 3.7% (390 B) - Previously Optimized";}s:34:"cat_post_thumb_sizecategoryposts-5";a:5:{s:4:"file";s:22:"4660428211-100x100.jpg";s:5:"width";i:100;s:6:"height";i:100;s:9:"mime-type";s:10:"image/jpeg";s:20:"ewww_image_optimizer";s:51:"Reduced by 9.8% (321 B) - Previously Optimized";}s:14:"ipmb-thumbnail";a:5:{s:4:"file";s:20:"4660428211-75x75.jpg";s:5:"width";i:75;s:6:"height";i:75;s:9:"mime-type";s:10:"image/jpeg";s:20:"ewww_image_optimizer";s:52:"Reduced by 13.8% (323 B) - Previously Optimized";}}s:10:"image_meta";a:10:{s:8:"aperture";i:0;s:6:"credit";s:12:"Getty Images";s:6:"camera";s:0:"";s:7:"caption";s:365:"LONDON, ENGLAND - JANUARY 31: Constance Briscoe, a barrister and part-time judge, arrives at Southwark Crown Court on January 31, 2014 in London, England. Ms Briscoe is accused of providing two inaccurate statements to police and altering a police witness statement, which were used in the trial of Chris Huhne and Vicky Pryce. (Photo by Dan Kitwood/Getty Images)";s:17:"created_timestamp";i:0;s:9:"copyright";s:17:"2014 Getty Images";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:78:"Constance Briscoe In Court To Face Charges Of Perverting The Course Of Justice";}s:20:"ewww_image_optimizer";s:52:"Reduced by 4.5% (1.9 kB) - Previously Optimized";}');

    How do I rebuild these _wp_attached_file and _wp_attachment_metadata?

  2. Filippo
    Member
    Posted 1 year ago #

    Hello, it took me a long time to put this together, can someone please help? Thanks

  3. Filippo
    Member
    Posted 1 year ago #

    Hi again, can you please reply on this? It's very important and your knowledge could be extremely helpful and appreciated

  4. Dave Naylor
    Member
    Posted 1 year ago #

    I built this plugin a couple of months back:

    https://github.com/WPRanger/wpr-rebuild-meta-data

  5. Filippo
    Member
    Posted 1 year ago #

    Thanks, I tried it but it didn't do anything

  6. Dave Naylor
    Member
    Posted 1 year ago #

    Did you rebuild the thumbnails afterwards?

  7. Filippo
    Member
    Posted 1 year ago #

    I tried again but it doesn't even load it: screenshot

  8. Dave Naylor
    Member
    Posted 1 year ago #

    Hmmm. I'll go investigate.

  9. millertchris
    Member
    Posted 3 months ago #

    Hey folks,

    Where you able to find a solution? I'm currently attempting to have the media library pick up on new images I've uploaded via SFTP to the uploads/* directory.

    I'm sure that it requires DB entries, however, I'm not sure where the table exist for the media library.

Topic Closed

This topic has been closed to new replies.

About this Topic