0

Facebook recommends to use for sharing images with a minimum size of 600 x 315 pixels and an 1.91:1 aspect ratio. Is there a way to automatically resize down original images uploaded to Wordpress to a size as close as possible to the recommended? I tried some plugins for resizing, but if images will not have the recommended 1.91:1 aspect ratio, one of the minimum sizes (width or height) will be smaller than recommended, because these plugins have a maximum size setting and not a minimum size setting. For example, if an original image have a size of 960 x 720 pixels, after resizing with a such plugin it have 420 x 315 pixels, so only the height is respected. In my WP installation posts are shared to FB with original images as a featured image, this is why I need a solution here. Maybe other scenarios can be used for this. Any help?

P.S. I can't set minimal dimensions for uploaded images because my posts are created by importing collected Facebook events which already have attached images of different sizes.

2
  • 960 x 720 pixels, after resizing it have 420 x 315 pixels I don't follow this part at all. Is it caused by native image size? A plugin? It's clearly larger than 600x315 minimum you want.
    – Rarst
    Commented Sep 14, 2017 at 16:57
  • @Rarst Sorry, is my fault, I was not very clear in my question. I need a size as close as possible to the recommended.
    – Yuri
    Commented Sep 14, 2017 at 17:46

1 Answer 1

1

From purely WordPress point of view you want add_image_size() with a "hard" crop mode. That will ensure that any significantly large image will be sized to fit into those dimensions exactly, cropping some parts if necessary.

The problem is usually that WP won’t upsize small images to fit, as far as I remember. It is most definitely possible to implement custom sizing logic, but it's not something straightforward really.

In my opinion hard crop size is reasonable low hanging solution here. Anything that it can't handle probably requires human attention for decent result anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.