Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby Image: Working fix to have image properly resize. #68

Open
martink-rsa opened this issue Jan 12, 2021 · 0 comments
Open

Gatsby Image: Working fix to have image properly resize. #68

martink-rsa opened this issue Jan 12, 2021 · 0 comments

Comments

@martink-rsa
Copy link
Contributor

ArticleImage / gatsby-image does not behave very well, and makes it very difficult to get it to fit the container.

This issue here mentions a fix which I've tested to be working: gatsbyjs/gatsby#15167

<div style={{ maxHeight: "100%", height: "45px" }}>
  <Img
    style={{ maxHeight: "100%" }}
    imgStyle={{ objectFit: "contain" }}
    fluid={data.placeholderImage.childImageSharp.fluid}
  />
</div>

I think the key difference is the imgStyle prop that is being used, which I think gatsby-image uses to style the image.

I've recreated it here and it's been working:

image

We are often having to dodge using ArticleImage. We need to have this applied to our Article Image without it breaking our other images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant