I need to make Wordpress resize automatically images on upload to fit a particular width and height. (say 300px by 400px)
I know the add_image_size() function but it doesn't seems to fit my needs. The image is either resized but it keeps his ratio or it is resized to the desired width and height but cropped! These are not what i'm looking for.
I need the image to be "contained" into a 300x400 rectangle like the css property "background-size: contain" with eventually blank margins on borders if the image has another ratio.
Any idea please ? :)