• rmarriage

    (@rmarriage)


    I logged in to a client site this morning after they reported having trouble uploading an image. I discovered the media library completely empty and the following error message displaying:
    Fatal error: Uncaught Error: Cannot use object of type DeliciousBrains\WP_Offload_Media\Items\Media_Library_Item as array in /home/rjmmedia/public_html/adamsleclair/wp-includes/media.php:217 Stack trace: #0 /home/rjmmedia/public_html/adamsleclair/wp-includes/media.php(932): image_downsize(3897, Array) #1 /home/rjmmedia/public_html/adamsleclair/wp-includes/media.php(985): wp_get_attachment_image_src(3897, Array, true) #2 /home/rjmmedia/public_html/adamsleclair/wp-admin/includes/class-wp-media-list-table.php(380): wp_get_attachment_image(3897, Array, true, Array) #3 /home/rjmmedia/public_html/adamsleclair/wp-admin/includes/class-wp-list-table.php(1353): WP_Media_List_Table->column_title(Object(WP_Post)) #4 /home/rjmmedia/public_html/adamsleclair/wp-admin/includes/class-wp-media-list-table.php(637): WP_List_Table->single_row_columns(Object(WP_Post)) #5 /home/rjmmedia/public_html/adamsleclair/wp-admin/includes/class-wp-list-table.php(1270): WP_Media_List_Table->display_rows() #6 /home/rjmmedia/public_html/adamsleclair/wp-admi in /home/rjmmedia/public_html/adamsleclair/wp-includes/media.php on line 217

    Both the plugin and WordPress are at their latest versions.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor ianmjones

    (@ianmjones)

    Any code outside of WP Offload Media using one of our as3cf_* filters?

    Thread Starter rmarriage

    (@rmarriage)

    @ianmjones Not that I can see. I disabled all plugins and still had the same issue. I’m using Themify Ultra for the theme and I check functions.php in both the theme and child theme. Nothing going on there.

    I should note that images uploaded since this error do show up in the library. I’m wondering now if there’s just a corrupt record in wp_posts that I should just remove from the database.

    Plugin Contributor ianmjones

    (@ianmjones)

    The problem is due to broken “_wp_attachment_metadata” records.

    You will need to find the Media Library items that have serialized “Media_Library_Item” objects in their values instead of the expected image data, and then remove and re-upload those items.

    If the Media Library item was not an image, e.g. a PDF, zip, or anything else that does not normally have a “_wp_attachment_metatdata” record, then you can just remove that broken “_wp_attachment_metadata” record and hopefully the item will be fixed. It will not have been offloaded though, so if using WP Offload Media Lite you’ll still need to remove and upload, but with WP Offload Media you can just hit the “Copy to Bucket” link.

    WP Offload Media Lite 2.3.1 has been released with code to help protect against this kind of thing happening again.

    Smush have also released a new version of there plugin that hopefully fixes compatibility with WP Offload Media.

    Thread Starter rmarriage

    (@rmarriage)

    Thanks @ianmjones. I’m pretty comfortable with the WP database. If I were to delete the meta data for each image, is there a plugin that you’re aware of to recreate it?

    Plugin Contributor ianmjones

    (@ianmjones)

    You could perhaps piece together a new record by using another good one as a starting point, the Pro version of my WP Table Pixie plugin could help you there.

    But that would be a bit of a slog, and prone to error, better to delete the Media Library item and re-upload.

    Thread Starter rmarriage

    (@rmarriage)

    Turns out the issue was specific to a couple of large PDF files. I just deleted the meta data for each of those files and the media library is back to normal.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal Error – Media Library Empty’ is closed to new replies.