Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images edited with the Media Library editor are not uploaded to Azure #148

Open
glouel opened this issue Oct 22, 2021 · 3 comments
Open
Labels
help wanted type:bug Something isn’t working.

Comments

@glouel
Copy link

glouel commented Oct 22, 2021

Describe the bug
Hey all,

First, thanks for this plugin. I found a restriction that, at this point, I'm not sure is a unimplemented feature or something that broke in recent Wordpress, so any guidance would be appreciated to see how/if I can help fixing this :

When using the built in edit feature of Wordpress's media library to edit an image, the result after it is saved is not uploaded to Azure Storage.

Furthermore the filename doesn't update to the newly generated image, making the image object still pointing to the previous version of the object.

Steps to Reproduce

  1. Go to Media Library, upload a file, the file gets correctly uploaded to Azure Storage
  2. Click on the newly uploaded image and press Edit Image Capture d’écran 2021-10-22 à 16 51 36
  3. Crop the image and press save
  4. After saving, the thumbnail will be blank in the editor and the file url will still point to the previous version of the file

Expected behavior
The edited version of the image should be uploaded to Azure Storage and correctly reference in the file url.

Environment information

Additional context
At this point it's not clear to me if this ever worked or is a recent bug. I tried looking at the code and I don't think there are any hook specific to the image editor in place.

What I noticed is that the new files get created locally (with a suffix), but there doesn't seem to be anything hooking with the plugin code to handle the upload of the assets or to fix the url. What's intriguing is that the URL never changes to the newly suffixed one (with or without the azure path).

From what I was able to dig on the topic, it's possible to hook on the file save with a filter on wp_save_image_editor_file. This may or may not be the optimal place to handle this as there may be a more appropriate hook further down the line.

There was a slightly similar issue that used another crop function here : #143 however the fix (which is part of the branch mentionned above that I tried) does not solve this.

Any chance I can get some guidance on if this ever worked or not, and if you have any tip on how I can help fix that. Thanks !

@glouel glouel added the type:bug Something isn’t working. label Oct 22, 2021
@jeffpaul
Copy link
Member

@glouel thanks for the detailed issue! We're working on a large update (see #136) and once that's complete we'll assess if your issue is resolved in that work or needs additional handling.

@jeffpaul jeffpaul added this to the 4.4.0 milestone Oct 22, 2021
@glouel
Copy link
Author

glouel commented Oct 25, 2021

Thanks for your quick answer @jeffpaul

Just to give you a bit more details, the reason I asked if this was possibly a recent issue is that I found a couple of recent reports of the same issue on wordpress.org, see :

https://wordpress.org/support/topic/failed-to-edit-image/

and

https://wordpress.org/support/topic/edited-image-is-not-uploaded/

Regarding your large update, I did test your branch 4.4.0 branch here : https://github.com/10up/windows-azure-storage/tree/feature/update-azure-blob-api and I can confirm that it doesn't fix the issue. Same goes for the various other patches/issues that I also checked.

I quickly looked at how other plugins handled the image editor but my understanding of wordpress internals is a bit limited.

I did notice however something that you may want to take into account at some point, because the editor uses GD locally to edit the files, you might have to "bring back" the image locally from Azure in case you don't keep a local copy, or eventually the edit will fail too. The S3 plugin does this.

I did not fully understand however how they detect the edit and save it back but wasn't able to spend much time looking it up.

This is independent of this main issue though, as even with a copy stored locally, the editor is not taken into account at all. Thanks for your support of this plugin in any case!

@jkonecki-techfabric
Copy link

I'm facing the same issue - is there a workaround available? Would downgrading to some older issue solve the problem (assuming the bug was introduced at some point) or the editor has never been supported?

This is a lovely plugin that otherwise works nicely!

@dkotter dkotter modified the milestones: 4.4.0, 4.5.0 Oct 13, 2023
@jeffpaul jeffpaul modified the milestones: 4.4.2, 4.5.0 May 6, 2024
@dkotter dkotter modified the milestones: 4.5.0, Future Release Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted type:bug Something isn’t working.
Projects
None yet
Development

No branches or pull requests

4 participants