enable-media-replace icon indicating copy to clipboard operation
enable-media-replace copied to clipboard

Replacing image does not update metadata for asset

Open Zxurian opened this issue 1 year ago • 5 comments

Using v4.0.3

When replacing an asset with a larger asset, the meta data is not updated within Wordpress. I have verified that the new asset is being uploaded and parsed, as the thumbnails are correctly regenerated, and by copying the File URL into a new tab, it does show the new asset at the larger dimensions, but the original image metadata is not updated.

This can also be seen when looking at the attachment metadata after uploading.

array (
  'width' => 1280,
  'height' => 700,
  'file' => '2016/05/grey-felt-screen-with-circles-cut-out-suspended-in-lounge-area-scaled.jpg',
  'filesize' => 727732,
  'sizes' => 
  array( ... ),
  'image_meta' => 
  array (
    'aperture' => '0',
    'credit' => '',
    'camera' => '',
    'caption' => '',
    'created_timestamp' => '0',
    'copyright' => '',
    'focal_length' => '0',
    'iso' => '0',
    'shutter_speed' => '0',
    'title' => '',
    'orientation' => '0',
    'keywords' => 
    array (
    ),
  ),
  'original_image' => 'grey-felt-screen-with-circles-cut-out-suspended-in-lounge-area.jpg',
)

It's still showing the original image data, not the new image data, which should be:

  'width' => 3000,
  'height' => 2086,
  'file' => '2016/05/grey-felt-screen-with-circles-cut-out-suspended-in-lounge-area-scaled.jpg',
  'filesize' => 2704020,
  

image

Zxurian avatar Mar 15 '23 16:03 Zxurian

hello @Zxurian and thanks for reporting this issue! I ran a few tests and couldn't reproduce this issue. In other words, when doing a replace (either with Just replace the file or Replace the file, use the new file name, and update all links the meta data flagged in the above image gets updated correctly. I, therefore, suspect there might be something else interfering with our plugin's functionality.

Are you able to test this on a site where only our plugin is active and a standard WordPress theme, to see if you can reproduce it? If it works, then you'll probably have to take the active plugins (and the theme) one by one and deactivate them until you find the one interfering. In case you're able to still reproduce it, please send us the 2 images that you're using, as well as the options you're using when doing the replace.

pdobrescu avatar Mar 15 '23 19:03 pdobrescu

I have a test site I can test with just standard WP Core & Enable Media Replace. I'll use the same image to reproduce and document steps. Currently we have two plugins that work with images, so it may be a matter of how it interacts with those plugins. Kraken Image Optimizer, & Infinity Uploads. I will perform some diagnostics with different enablements to see what series of combination / steps reproduces the issue.

Zxurian avatar Mar 15 '23 23:03 Zxurian

hello @Zxurian, can you please check if you are still encountering the issue without other active plugins? We are preparing to release a new version this week and if a fix is required, I'd like to include it in this release. Thanks!

pdobrescu avatar Mar 27 '23 10:03 pdobrescu

sorry, took a bit to have some time. So going off of a clean install. No images at all. Now using v4.1.0 of Enable Media Replace Using the following plugin list:

Advanced Custom Fields PRO
Category Order and Taxonomy Terms Order
Disable Author Archives
Disable Comments
Enable Media Replace
Genesis Blocks Pro
Media Library Assistant
Pretty Links
Query Monitor
Redirection
Relevanssi
SVG Support
WooCommerce
WP Rollback
WP-SCSS

First roadblock I ran into is when trying to just replace a media file with a new file

  1. https://i.imgur.com/PSvSQbC.png
  2. Click "Upload a new file"
  3. Select new file, with options of "replace the file and use new name", "replace with current date" https://i.imgur.com/qj2seiT.png
  4. Got the following error: https://i.imgur.com/IBjQEQF.png

Zxurian avatar Mar 29 '23 10:03 Zxurian

Dear @Zxurian, apologies for getting back to you on this so late.

I looked over the screenshots you sent and noticed something that drew my attention. I'm talking about the slashes from this screenshot:

image

Something doesn't seem right in that path, using both backslashes and forwardslashes. Are you by any chance running WordPress on a Windows environment/server? While I've seen sites running (and our plugin functioning correctly with Windows-style paths), this is the first time I've seen both backslashes and forwardslashes in a path. I'm pretty sure this is the reason behind the errors you're seeing.

pdobrescu avatar Dec 08 '23 12:12 pdobrescu

Closing, as we haven't got any updates here. If there are still errors, please reopen this issue.

pdobrescu avatar Aug 30 '24 16:08 pdobrescu