• This is related to what I thought was an issue reported on the Github project a couple of years ago…

    https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/issues/408

    We use the latest WordPress version and WP Offload Media Lite plugin with the ‘remove from server’ option and still have not been able to edit for the same reasons. The error seen in the logs when trying to edit an example image is this:

    AS3CF: File /home/www/wmnf/www/wp-content/uploads/https://wmnf.s3.amazonaws.com/wp-content/uploads/2020/07/Peace-e1595245110243.jpg does not exist, referer: https://dev.wmnf.org/wp-admin/post.php?post=134366&action=edit

    It was determined in the issue post that the meta data created is problematic. The meta data for this example is shown below where the _wp_attached_file and _wp_attachment_metadata should not be a URL. However, as seen in the screenshot also linked below shows all fields similar to that posted as a working example screenshot in the issue post. I have tried setting up a completely new VPS and website with CentOS and the latest version of WP and only WP Offload Media Lite plugin activated and have the same issue.

    Screenshot: https://ibb.co/JnRvxFf

    MariaDB [wmnf_www]> select meta_key,meta_value from wp_postmeta where post_id = 134366;
    +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | meta_key                    | meta_value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
    +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | _wp_attached_file           | https://wmnf.s3.amazonaws.com/wp-content/uploads/2020/07/Peace-e1595245110243.jpg                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
    | _wp_attachment_metadata     | a:5:{s:5:"width";i:160;s:6:"height";i:160;s:4:"file";s:81:"https://wmnf.s3.amazonaws.com/wp-content/uploads/2020/07/Peace-e1595245110243.jpg";s:5:"sizes";a:4:{s:15:"bones-thumb-600";a:4:{s:4:"file";s:17:"Peace-160x150.jpg";s:5:"width";i:160;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:15:"bones-thumb-300";a:4:{s:4:"file";s:17:"Peace-160x100.jpg";s:5:"width";i:160;s:6:"height";i:100;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:17:"Peace-125x125.jpg";s:5:"width";i:125;s:6:"height";i:125;s:9:"mime-type";s:10:"image/jpeg";}s:14:"rpwe-thumbnail";a:4:{s:4:"file";s:15:"Peace-45x45.jpg";s:5:"width";i:45;s:6:"height";i:45;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}} |
    | as3cf_filesize_total        | 22151                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
    | _edit_lock                  | 1595245290:5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
    | _wp_attachment_backup_sizes | a:1:{s:9:"full-orig";a:3:{s:5:"width";i:160;s:6:"height";i:160;s:4:"file";s:9:"Peace.jpg";}}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
    +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    5 rows in set (0.001 sec)

    Has anyone else seen this type of issue when editing an image using the remove from server option with WP Offload Media Lite? Or have a suggestion of how this could be troubleshooted further or resolved?

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

    (@ianmjones)

    That _wp_attached_file value that is a URL and the similar “file” entry in _wp_attachment_metadata are incorrect, they should be paths relative to wp-content/uploads/, e.g. “2020/07/Peace-e1595245110243.jpg”.

    When editing the _wp_attachment_metadata field be super careful to properly adjust the length indicator for the string you’re updating, otherwise it’ll be broken and WordPress will refuse to load it.

    You should try and find what plugin is corrupting those postmeta records, it’s likely an image optimizer, cropper, or something else that post-processes images and can’t handle remote files.

    wmnf

    (@wmnf)

    Thanks. Okay, I created a brand new site and all works well with default twenty-twenty theme and only this plugin activated. I then disabled all plugins except this one and reverted to the default twenty-twenty theme in the site with the issue, the problem still exists.

    I find the full URL in the fields noted previously and manually edit as you suggested from this:

    | _wp_attached_file           | https://wmnf.s3.amazonaws.com/wp-content/uploads/2020/07/Capture-e1596025430398.png                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
    | _wp_attachment_metadata     | a:5:{s:5:"width";i:446;s:6:"height";i:747;s:4:"file";s:83:"https://wmnf.s3.amazonaws.com/wp-content/uploads/2020/07/Capture-e1596025430398.png";s:5:"sizes";a:1:{s:6:"medium";a:4:{s:4:"file";s:19:"Capture-300x179.png";s:5:"width";i:300;s:6:"height";i:179;s:9:"mime-type";s:9:"image/png";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}} |

    To this:

    | _wp_attached_file           | /2020/07/Capture-e1596025430398.png                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
    | _wp_attachment_metadata     | a:5:{s:5:"width";i:446;s:6:"height";i:747;s:4:"file";s:35:"/2020/07/Capture-e1596025430398.png";s:5:"sizes";a:1:{s:6:"medium";a:4:{s:4:"file";s:19:"Capture-300x179.png";s:5:"width";i:300;s:6:"height";i:179;s:9:"mime-type";s:9:"image/png";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}} |

    Then it reverts after I click the save button with the same error in the logs:

    AS3CF: File /home/www/wmnf/www/wp-content/uploads/https://wmnf.s3.amazonaws.com/wp-content/uploads/2020/07/Capture-e1596024671925.png does not exist

    I realize this is not an issue with the plugin, but could you suggest how I could troubleshoot further? I have checked and edited the .htaccess file to only have the default WordPress Rewrite entries only and removed a couple of custom mu-plugins.

    Plugin Contributor ianmjones

    (@ianmjones)

    The _wp_attached_file value and paths in _wp_attachment_metadata should not have a leading /.

    Other than that, you’ll need to find out which other plugin in the original site is editing the attachment data and incorrectly adding the remote URL. Might be a case reproducing and then deactivating plugins one by one until you can’t reproduce it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.