Replies: 2 comments 1 reply
-
At this time, this limitation is intentional in our base services. However, it is quite easy to wrap our image service (you can import them If anyone is interested, we'd definitely approve of a community-owned image service for this, could just wrap ours for the boring parts and add all the options Sharp support. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I also need something like that. It'd be so useful. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Body
Summary
Add support for some resize options of Sharp such as
fit
orposition
Background & Motivation
When both
width
andheight
are set inImage
component, the Sharp image service prioritizes width and always respects the original ratio of the image. Because of this you can't create different formats from a single source image.Now imagine you have a content with a 1200 x 600 px image, you want to generate a square thumbnail for in a content you want to have a square and you use
Image
component withwidth
andheight
at 200, it will generate an 200 x 100 px image because it respects original ratio.This could be solved by supporting resize options of Sharp such as
fit
andposition
to crop the image.Example
An example of how it could work, with a
resizeOptions
property added toImage
component, only used ifThen it could be used this way in Sharp service, only used if both
width
andheight
properties are set :Beta Was this translation helpful? Give feedback.
All reactions