contao / image

Contao Image Library
12 stars 5 forks source link

Add more resize modes #85

Open ausi opened 3 years ago

ausi commented 3 years ago

Should we add more resize modes like a version of box that adds a background color to the image to get exactly the configured size?

A general background color setting might be useful for other cases too like converting images with transparency to JPEG.

/cc @bennyborn Related: https://github.com/contao/contao/issues/3347

Are there other resize modes that might be useful?

bennyborn commented 3 years ago

IMHO "color" should also include transparent.

From my own experience with customers I'd also suggest the option to "blow up" images beyond their original size. I know it might look absolutely crappy but "normal" users are often not able to provide images for news or events that meet the minimum required resolution to fit nicely into the layout.

ausi commented 3 years ago

I'd also suggest the option to "blow up" images beyond their original size.

We decided against this feature as it unnecessarily increases the network traffic. The upscaling should happen on the client side. See also https://github.com/contao/image/issues/48#issuecomment-455538235

IMHO "color" should also include transparent.

Agreed. And transparent should be de default I think.

asaage commented 3 years ago

A version of box that adds a background color to the image to get exactly the configured size without increaseing network traffic can also be achived o the client side with css. For example if you put desired aspect-ratio and background-color on the .image_container and center the image within. 🤷🏼‍♂️

ausi commented 3 years ago

For example if you put desired aspect-ratio and background-color on the .image_container and center the image within. 🤷🏼‍♂️

You can even do that with the image itself, see https://github.com/contao/contao/issues/3347#issuecomment-902538673

ausi commented 3 years ago

A version of box that adds a background color to the image to get exactly the configured size without increaseing network traffic can also be achived o the client side with css.

I think adding a solid background color should not increase the image size too much as most image formats can compress such things very good.