kadence-blocks icon indicating copy to clipboard operation
kadence-blocks copied to clipboard

Enhancement: Keep Media Settings when changing media image file

Open SJNBham opened this issue 4 years ago • 4 comments

We're trying to create a reusable block with a row of Info Boxes so our content editors can easily build menu pages. We've configured the Info Box > Media Settings > Media Type > media file to a dummy placeholder image. We've also set the Image File Size and Max Image Width. However, when the reusable block is inserted, converted to a regular block, and then the image file is swapped out for a new one in the Info Box blocks, the Image File Size and Max Image Width get reset. Wondering if it's possible to put some logic in that to only reset those two settings if they're not applicable to the newly selected image. For example, if the new image was too small to have the previously selected image size thumbnail.

menu

SJNBham avatar May 14 '20 23:05 SJNBham

Thought I'd mention this isn't just related to our use case of reusable blocks. Anytime an editor tries to change out the media file on an Info Box block it resets those settings.

SJNBham avatar May 14 '20 23:05 SJNBham

I noticed an entry in the 1.8.3 release notes that seems to relate to this request - not sure if it does. When I test changing out the media file, it still defaults to the full-sized thumbnail instead of retaining the previously set thumbnail size. However, it seems to be keeping the Max Image Width setting now. Adding a screen capture to illustrate.

media-size

SJNBham avatar May 18 '20 19:05 SJNBham

Hey, I've put this on my list to consider some options for, Gutenberg has some shortcomings when it comes to achieving what you want. When you select an image the data that is sent through the Gutenberg component doesn't include information about which custom image sizes are available for the image and so I'd need to write something that queries the rest API for more information about the image to verify if the image size is available that was set for the previous image when a custom (non-core) size is used.

Ben

kadencewp avatar May 18 '20 19:05 kadencewp

Thanks Ben - appreciate anything you can do ;)

SJNBham avatar May 18 '20 20:05 SJNBham