Normally when you set a custom image size using hard crop - e.g. add_image_size( 'custom-size', 400, 400, true );
- you get the following results:
- #1 Uploaded image: 600x500 > Thumbnail: 400x400.
- #2 Uploaded image: 500x300 > Thumbnail: 400x300.
- #3 Uploaded image: 300x200 > Thumbnail: 300x200.
However what I'd like to do is when the uploaded image is smaller than the set width, or height, or both, of the custom image size, e.g. examples #2 & #3 above - instead of the image just being cropped to fit within those dimensions - it's also cropped to match their aspect ratio (which in this case is 1:1) like so:
- #1 Uploaded image: 600x500 > Thumbnail: 400x400.
- #2 Uploaded image: 500x300 > Thumbnail: 300x300.
- #3 Uploaded image: 300x200 > Thumbnail: 200x200.
I don't believe this is possible using the standard add_image_size options, but is it possible using a different function, or hook that modifies the add_image_size function?
Or is there a plugin that adds this functionality?
Any information anyone can provide would be greatly appreciated.
add_image_size
to do what I've described above. I'm fairly sure this isn't possible using the standard parameters, but I'm hoping it's possible using a hook, action, or filter.