thirtybees icon indicating copy to clipboard operation
thirtybees copied to clipboard

Images: Can we fill the background with set color?

Open therampagerado opened this issue 2 years ago • 3 comments

I was using the ImageMagic plugin that was doing this but after the introduction of webp format it was causing some issues so I had to remove it.

After the regeneration of all images the ones where the source is not square are showing with the same proportions in FO. Which is not nice.

Can we have some setting in Images where with chechmark admins can select if this fill up to the set square (or not) size is needed and another field to choose the fill color?

This might interfere with many modules that manipulate this field but I believe it's a must for more consistent images and should be part of Core not in a module.

A workaround is -> get source images -> open in software, edit, export a square image -> use in site.

Slow and inneficient even with bulk export.

therampagerado avatar Jan 21 '23 20:01 therampagerado

After the regeneration of all images the ones where the source is not square are showing with the same proportions in FO. Which is not nice.

Generated thumbnail webp images are square, with only a transparent background. If you modify line 354 in ImageManager class to for example: $transparent = imagecolorallocatealpha($destImage, 0, 128, 0, 0); This background will be green. 55-Niara_large

e-com-presta avatar Jan 22 '23 04:01 e-com-presta

I didn't know that.

Nevertheless this is not a viable option if I make weekly updates to edge (as I do)... Can I make an orverride somewhere?

therampagerado avatar Jan 22 '23 08:01 therampagerado

Of course that you can add override of ImageManager class with modified resize() method. And then the updates will not affect background color of generated thumbnails.

e-com-presta avatar Jan 22 '23 09:01 e-com-presta