Codeinwp / optimole-wp

30 stars 8 forks source link

Broken Image Links in Media Library After Editing Offloaded Images #778

Open kushh23 opened 8 months ago

kushh23 commented 8 months ago

Description

We have encountered an issue where editing offloaded images directly from the WordPress media library (e.g., rotating or cropping) causes the images to appear broken in the media library view. Additionally, these edited images do not get offloaded again as expected. If images are edited before being offloaded, everything functions correctly. However, editing images that have already been offloaded results in broken image links and strange URL patterns.

For example - https://succinctuse.s4-tastewp.com/wp-content/uploads/id:27906dd4c67ff11d6241c6c467ffbd58/https://succinctuse.s4-tastewp.com/IMG_7112-e1708458595987.jpg

This bug affects especially those users who need to make post-offload edits to images.

The user who reported this provided some insights and a solution but when I tried it didn't worked for me. I was facing the same issue with the filter they provided. Any insights or fixes for this issue would be greatly appreciated.

Step-by-step reproduction instructions

  1. Offload an image from the WordPress media library using our offloading functionality.
  2. Once the image is offloaded, attempt to edit the image (e.g., rotate or crop) using WordPress media edit options.
  3. Save the changes and return to the media library view.

Screenshots, screen recording, code snippet or Help Scout ticket

https://vertis.d.pr/v/CzCYYf https://secure.helpscout.net/conversation/2514329513/405110/

Environment info

No response

Is the issue you are reporting a regression

No

girishpanchal30 commented 2 months ago

Hey @kushh23,

I reviewed this issue, and I found that the WP default image editor does not work if we select the Optimole Cloud only setting. Ref: https://tinyurl.com/yuh3wkla

Once we select this option, images will be saved on the Optimole Cloud server only, and the WP default image editor needs a local image path to edit an image.

Solution

We can redirect to the Optimole Libary page when use click on the edit link if the Optimole Cloud only setting is enabled.

cc @selul

Thanks

selul commented 2 months ago

@girishpanchal30 can't we do something to use the Optimole image on edit and the processing option? Maybe we custom editor class? would be a complex thing to do?

girishpanchal30 commented 2 months ago

@selul I noticed that Optimole provides an image editor within an iframe that loads all images. Is there any way to support loading a single image in the iframe using a specific URL?

If it is possible we could explore options to replace the WordPress image editor with the Optimole image editor.

Thanks