Description
Without a proper support for fit image, it's basically impossible to use existing image content (e.g. a product's master image) in an appropriate way for social shares - i.e. none of the Craft transform modes produce the desired result of an actual image fit.
Craft, since 4.4, offers a new 'Letterbox' transform mode, that is akin to 'fit image' in most image processing programs, i.e. both the height and width are made to fit within the given bounds.
Craft chooses to pad this image it seems, and for reasons I can't really understand, seems to default to padding with black.
I hacked support into facebook-og-image-partial.twig
:
{% set imageCropModes = {
"crop": "Crop"|t("seomatic"),
"fit": "Fit"|t("seomatic"),
"stretch": "Stretch"|t("seomatic"),
"letterbox": "Letterbox",
} %}
This improves things a lot, but needs white padding (by default), possible selectable - and isn't quite all the way there, if the preview is accurate:
'Fit' selected:
'Letterbox' selected - I am unsure why this still gets cropped TBH:
It would be really great to have a solve for this issue, it's been bugging me for years now - every time I see a share of one of our things go past and the image is all messed up, it makes an SEO fairy somewhere fall out of the sky, and die.