WordPress / create-block-theme

A WordPress plugin to create block themes
https://wordpress.org/plugins/create-block-theme/
GNU General Public License v2.0
310 stars 44 forks source link

Metadata screenshot #621

Closed pbking closed 1 month ago

pbking commented 1 month ago

Add ability for user to manage the theme's screenshot from Editor on Metadata Modal.

Fixes: #560

image

To Test:

The image should be replaced in the theme folder and sized to 1200 x 900 px.

If a screenshot existed prior it should be removed. (Especially if the previous screenshot was another file type)

pbking commented 1 month ago

I removed the Remove button as I don't think that the screenshot should ever not be there.

t-hamano commented 1 month ago

@pbking Thank you for your quick implementation! I would like to test the backend a little more, but first I made some adjustments to the UI. What do you think? Are the buttons a little too noticeable?

Before After
no-screenshot-before no-screenshot-after
has-screenshot-before has-screenshot-after
pbking commented 1 month ago

What do you think? Are the buttons a little too noticeable?

I think they are fine either way. I like the option you just pushed slightly better though.

👍

madhusudhand commented 1 month ago

It works great. I have observed one minor issue with image size. Tried uploading following image

image-alignment-1200x4002-1

It previews screenshot differently.

image image

We should probably consider both ratio 4:3 and max size 1200x900 while resizing ?

pbking commented 1 month ago

Hrm 🤨

Regarding the wide image... The size restrictions are noted as a MAXIMUM of 1200 x 900. Which the image fits in. The original is less than 900 pixels tall. I believe that the cropping/resizing is acting as I would expect.

I tried another image that was very wide, but over 900 px tall (2500 x 1200) and it cropped and resized to the expected 1200 x 900 size.

There might be a better way to handle this edge case (upscaling the image maybe? then cropping it?) but I don't think it's worth the effort (when a user should really be providing an image of the appropriate dimensions anyway...)

If you believe that we should consider addressing that further would you mind opening an issue to explore additional solutions @madhusudhand ?