junaidbhura / auto-cloudinary

Super simple Cloudinary auto-upload implementation for WordPress.
https://wordpress.org/plugins/auto-cloudinary/
MIT License
41 stars 9 forks source link

Image block size will not change on Block editor #25

Closed sukezane closed 4 years ago

sukezane commented 5 years ago

Describe the bug Cannot select image size on Image block after activated Auto Cloudinary plugin.

To reproduce

  1. Go to Posts > Add New
  2. Add Image block on editor.
  3. Choose an image on Media Library
  4. Select image size on Image block settings, for example, choose ‘Medium’ スクリーンショット 2019-09-04 14 57 27

Expected behavior Image size will change and updated image size on actual post. On Image Size dropdown list, all option value has different sources by each sizes. スクリーンショット 2019-09-04 15 00 12

Actual behavior Image size will not change. On Image Size dropdown list, all option value has same sources. スクリーンショット 2019-09-04 14 59 18

Additional context

junaidbhura commented 5 years ago

Hey @sukezane thanks for this issue, and apologies for the delayed response. Let me take a deeper look at this and get back to you!

junaidbhura commented 5 years ago

@sukezane The plugin has now been updated with a fix!

sukezane commented 5 years ago

Thanks @junaidbhura ! But I think this issue is not fixed. Image Size dropdown lists' option value still has same image sources after activated newer version plugin.

sukezane commented 5 years ago

@junaidbhura When I added __return_false to cloudinary_filter_image_downsize filter on my functions.php, it seems to be worked. So I think this problem is occurred on filter_image_downsize function on class-frontend.php.

In addition, when I looked into editor, I found image block's image sizes are fetched from WP REST API on /wp/v2/media/ endpoint. Since this endpoint used on editor, it might fix if this function is triggered only on actual post.

junaidbhura commented 5 years ago

@sukezane Thanks for letting me know. I've created a new branch with a fix: https://github.com/junaidbhura/auto-cloudinary/tree/editor-sizes-fix

Can you try this and let me know if it fixes the issue?

sukezane commented 5 years ago

@junaidbhura Thanks! It fixed.

junaidbhura commented 5 years ago

Thanks for confirming @sukezane ! I'll do a plugin release soon!