craft-imageoptimize
craft-imageoptimize copied to clipboard
Sharp, Modes and Fit
Question
We are using the Sharp Transform Method and the createOptimizedImages()
function in a twig template. (Don't judge)
What is the best way to configure modes and fit? Am I missing something? Would be cool if we could pass that in with the variant.
Sometimes we want to 'cover' and sometimes we want to 'contain'
{
'width': width,
'useAspectRatio': ( height != null ) ? true : false,
'aspectRatioX': width,
'aspectRatioY': height,
'retinaSizes': ['1'],
'quality': 90,
'format': 'jpg',
'fit': 'contain'
}
Probably also background color. It is black at the moment. When forced to 'contain'.