umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.49k stars 2.69k forks source link

Crop Previews in media picker are not presented for crops with specific dimensions #10953

Closed dydimitrov closed 2 years ago

dydimitrov commented 3 years ago

Which exact Umbraco version are you using? For example: 8.13.1 - don't just write v8

8.15.2

Bug summary

MediaPicker in the Backoffice and open the image settings. You should see that the preview for the crop with size for example 1260/0px is not presented

Specifics

No response

Steps to reproduce

1.Create crop for image with dimensions 1280px/0px

  1. This crop is supported and the images are scaled properly
  2. Go to MediaPicker in the Backoffice and open the image settings. You should see that the preview for this crop is not presented

Expected result / actual result

The expected result is to have a preview for all of the crops for the image Actual result Umbraco_Preview_Image_Crops_Issue

nul800sebastiaan commented 3 years ago

Okay, clearly you can't have an image with on of the dimensions being 0 pixels, so that should be fixed. We'd be happy for a hand there! 👍

umbrabot commented 3 years ago

Hi @dydimitrov,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly Umbraco GitHub bot :-)

RosenPetrov commented 3 years ago

@nul800sebastiaan I am not sure that I am right, but correct if I am wrong.

Currently, we actually use the 0 dimensions, and I don't think they should be disallowed. Let's take an example: 1280x0 means that I really care about the width of the image to be 1280, and it should make it as wide and scale the height keeping the aspect ratio. And this is working in Umbraco ATM. The image processor (not sure how it is called) actually handles 0 in that manner, and we use that feature.

So, I think we need to keep the opportunity to specify 0 for either width or height.

The actual problem is purely FE ATM. Because the FE uses that sizes to style the box, so it has a preview. And when it's 0 it doesn't expand the box. Don't know how to fix that, but I think we should figure it out on the FE and not disallow the 0 option.

nul800sebastiaan commented 3 years ago

@RosenPetrov Alright.. but why? I don't understand the use case of having an image with a dimension of 0, meaning it will never show up? It sounds a bit like we're back in the 90s and you need a spacer.gif 🙈 😅 ?

RosenPetrov commented 3 years ago

@nul800sebastiaan The image won't be 0px in height.

Let's say you upload in image with size 3000x1000 (width x height) and another 4000x2500 but in some places on the site you need pictures with width 1200 and you don't care about the height. So, you want to scale from 3000x1000 to 1200xSomething and 4000x2500 to 1200xSomething (keeping aspect ratio) Then you specify 1200x0 crop. Does that make sense?

This actually works in Umbraco atm

It's the 0 which gives this confusion. Then it could be an option to change the prop for the crops from number to string and allow 'auto' if makes more sense. 1280 x auto

umbrabot commented 2 years ago

Hiya @dydimitrov,

Just wanted to let you know that we noticed that this issue got a bit stale and might not be relevant any more.

We will close this issue for now but we're happy to open it up again if you think it's still relevant (for example: it's a feature request that's not yet implemented, or it's a bug that's not yet been fixed).

To open it this issue up again, you can write @umbrabot still relevant in a new comment as the first line. It would be super helpful for us if on the next line you could let us know why you think it's still relevant.

For example:

@umbrabot still relevant This bug can still be reproduced in version x.y.z

This will reopen the issue in the next few hours.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face: