core icon indicating copy to clipboard operation
core copied to clipboard

Imagesize: add resize-mode options

Open asaage opened this issue 9 years ago • 27 comments

Might be no issue but it appears inconsitent to me. Is there a reason why predefined imagesizes do not make the options (center|center, left|bottom, right|top, ...) available?

image

compared to CE image / gallery image

asaage avatar Jun 10 '16 10:06 asaage

yes ... there is a reason, because responsive images are working with important area of image! So you can choose individual per image which area your user will see.

frontendschlampe avatar Jun 10 '16 11:06 frontendschlampe

But the "important part" is possible with ce_image and ce_gallery as well.. Setting the important part for 300 pic's of a gallery (each with the same dimensions) because you want the bottom-part to be cropped in the thumbnails is rather cumbersome.

anyway - i can still use the exact dimensions of the gallery palette if i keep track of the appropriate pixel-values for the corresponding layout.

asaage avatar Jun 10 '16 11:06 asaage

yes ... there is a reason, because responsive images are working with important area of image!

They don't need to though. You might want to always view the top or bottom of an image for example when cropping, but that's not possible with predefined image sizes currently.

fritzmg avatar Jun 10 '16 14:06 fritzmg

@ausi /cc

leofeyer avatar Jun 12 '16 09:06 leofeyer

You might want to always view the top or bottom of an image for example when cropping, but that's not possible with predefined image sizes currently.

It is possible if the important parts are set respectively. I don’t really see the use case for cropping an image not respecting the important part.

The reason why the options like center|center are still available in content element settings is because of backwards compatibility.

ausi avatar Jun 12 '16 14:06 ausi

It's not really about not wanting to respect the important part.

As @asaage explained, you currently have no way of always cropping the image to the top/left/right/bottom automatically, when using a predefined image size. You can only do that indirectly by setting the important part accordingly, but you would have to manually do that for every image and even then you are stuck with that part of the picture.

fritzmg avatar Jun 12 '16 14:06 fritzmg

in other words: with imagesizes (mode: crop, zoom: 100 and no important-part set on the images) it falls back to center|center wich is not allways that what you want.

But if you consider this a "very special usecase" feel free to label this invalid, feature or closed as the alternative (setting the size on the gallery/image element manualy) is still working.

asaage avatar Jun 12 '16 15:06 asaage

These resize modes are very limited, the zoom value has no effect and you cannot use more specific positions like 30% from the top.

If we want to have this sort of functionality for the predefined image sizes, I would rather prefer a different approach. Like specifying an important part in the image size that gets used as a fallback or an override.

If this is a “very special use case” or not is not on me to judge, but it could be helpful if you can provide some examples.

ausi avatar Jun 12 '16 16:06 ausi

specifying an important part in the image size that gets used as a fallback or an override

would be great:+1: I think that was, what i was asking for.

asaage avatar Jun 12 '16 17:06 asaage

Hm, but an image size setting might be applied to a variety of images with different aspect ratios and sizes. How would you be able to set a fallback important part? Or would that fallback just be left | left etc. like before?

fritzmg avatar Jun 13 '16 11:06 fritzmg

I thought of x, y, width and height as percentage values.

ausi avatar Jun 13 '16 11:06 ausi

i thought of just cropping with one of the mentioned options if no important part is set on the image.

asaage avatar Jun 13 '16 12:06 asaage

@ausi This has not yet been implemented, has it?

leofeyer avatar Oct 28 '16 07:10 leofeyer

No. The way we wanted to implement it (just add the old resize modes to the select), was not possible because one image can only have one important part in the Picture class. AFAIR we discussed that in the dev meeting in july.

ausi avatar Oct 28 '16 07:10 ausi

So can I close the ticket?

leofeyer avatar Oct 28 '16 09:10 leofeyer

IMO yes.

ausi avatar Oct 28 '16 09:10 ausi

Why would it be necessary for this feature to have multiple important parts? If you select one of the old options, you specifically request to ignore the specified important part of the image (if present at all).

fritzmg avatar Oct 28 '16 09:10 fritzmg

If you select one of the old options, you specifically request to ignore the specified important part of the image.

The problem is that an image size can have multiple media queries with resize modes that conflict to each other.

ausi avatar Oct 28 '16 09:10 ausi

I see what you mean now. But still, can there really be no solution for that? Telling editors that they now have to set an important part on every image in possibly huge galleries for example, just to always have the top parts of the image is a bit... maddening ;)

fritzmg avatar Oct 28 '16 09:10 fritzmg

One solution would be, that the resize modes in the media queries just get ignored in that case (also the zoom level). Completely ignoring the image size media queries would also work. But I don’t really like these solutions because they would be quite confusing IMO.

ausi avatar Oct 28 '16 09:10 ausi

Hm, or you could be forced to the resize mode of the parent or the first media query (in the DCA view)? Still not that pretty, but possibly a little less confusing.

fritzmg avatar Oct 28 '16 09:10 fritzmg

I think we could implement such a not-optimal solution if this feature is really needed, but I don’t know of a use case for this feature, can you name one?

ausi avatar Oct 28 '16 09:10 ausi

Yes, one customer for example often has a lot of galleries with people in them. Usually the people's heads are mostly in the top part of the picture, thus he would use the resize mode top | center. Since that setting is not supported by the image size sets, we weren't able to provide him with an image size setting that he could use for a gallery. Instead he needs to set the resize mode and more importantly the appropriate width and height values himself for every new gallery (assuming that we did not implement a default setting for the DCA or a load_callback). Also this way you cannot also use the sizes attribute. (Furthermore in Contao 3 you weren't able to use default densities without my extension, but at least that feature will be present in Contao 4.3.0.)

fritzmg avatar Oct 28 '16 10:10 fritzmg

I think the problem with this approach is, that if one single image of them doesn’t have the head in the top-center part, the image gets cropped incorrectly.

Wouldn’t a better solution for this problem be to make it easier to set the important part of multiple images?

Or in your specific case you could automatically set the important part of every new uploaded image to the top-center part. If an image doesn’t get cropped correctly then, the customer could correct the important part of that image.

ausi avatar Oct 28 '16 12:10 ausi

I think the problem with this approach is, that if one single image of them doesn’t have the head in the top-center part, the image gets cropped incorrectly.

True, but so far the customer didn't care about that.

Wouldn’t a better solution for this problem be to make it easier to set the important part of multiple images?

Well, that would still be cumbersome, imho.

I think it would be better if the old resizing modes actually worked as a fallback, whenever no important part is available. Wouldn't that be more feasible?

fritzmg avatar Oct 28 '16 12:10 fritzmg

I think it would be better if the old resizing modes actually worked as a fallback, whenever no important part is available. Wouldn't that be more feasible?

I don’t think so. That would make them work differently than before.

If we want to be able to set a fallback important part I would prefer setting x, y, width and height as percentage values. That would be much more flexible and useful, but make the settings also more bloated I think.

ausi avatar Oct 28 '16 12:10 ausi

i think it's fine to discard the important part completely if the user selects top-left, bottom-right, center-center, ... that would be the important part then.

asaage avatar Oct 28 '16 15:10 asaage