You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently the Image component parses the originalWidth and originalHeight from the Storyblok image URL within getImageProps and returns them for imageProps as width and height:
These are then used for the dummy element spanning the container for the aspect ratio, which makes it impossible to adjust the aspect ratio from the outside:
Describe the solution you'd like
Do you see a way to provide a desired aspect ratio through props or inferring them from fluid or fixed props when they contain width && height?
Maybe even the handling of the aspect ratio itself could be improved by using CSS aspect-ratio:
I am running into this issue as well. I am trying to use a "fixed" image that I supply a width and height. The width and height are correctly put into the image url and load an image with those exact dimensions however the div with padding-top that achieves the image ratio is based off of the original images dimensions.
Is your feature request related to a problem? Please describe.
Currently the
Image
component parses theoriginalWidth
andoriginalHeight
from the Storyblok image URL withingetImageProps
and returns them forimageProps
as width and height:storyblok-toolkit/src/image/getImageProps.ts
Lines 47 to 48 in 3bae06a
These are then used for the dummy element spanning the container for the aspect ratio, which makes it impossible to adjust the aspect ratio from the outside:
storyblok-toolkit/src/image/Image.tsx
Line 131 in 3bae06a
Describe the solution you'd like
Do you see a way to provide a desired aspect ratio through props or inferring them from
fluid
orfixed
props when they containwidth && height
?Maybe even the handling of the aspect ratio itself could be improved by using CSS
aspect-ratio
:Describe alternatives you've considered
For now we had to patch it from the outside using a custom wrapper:
Let me know what you think, happy to discuss the details or helping with the implementation :)
/cc @martinjuhasz
The text was updated successfully, but these errors were encountered: