Keeping image size and filling background with color till the size i want

See all posts See thread Reply

Re: Keeping image size and filling background with color till the size i want new!
by colin, 15 years, 3 months ago
There is no automatic way to do what you want.

However, starting wit hthe code that you have, you can use image_cropwith negative values in order to add "space" on the sides of the picture if the original picture is less than 200px wide.

So if the picture's width (or height) is less than 200px, you keep it as is, and calculate the space you need to add, and set a negative cropping value. If the image is 200px or wider, then you simply resize it using image_ratio_crop or image_ratio_fill.Reply