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] object fit is not configurable #3561

Closed
jonathan-chin opened this issue Jan 17, 2018 · 3 comments
Closed

[gatsby-image] object fit is not configurable #3561

jonathan-chin opened this issue Jan 17, 2018 · 3 comments
Assignees

Comments

@jonathan-chin
Copy link

jonathan-chin commented Jan 17, 2018

It took me a while to uncover this, because I was using gatsby-plugin-sharp and react-flexbox-grid, so I was investigating those. However, it seems that gatsby-image only loads images within their wrapper as object-fit: cover. With certain aspect ratios, this cuts off the edges. For example:

https://imgur.com/a/jW8kg

The lefthand side is ever so cropped (so is the righthand side of the whole image but it's less noticeable there so I just snapped the left side). I looked into the source of gatsby-image and the css style is hardcoded as cover. Is there a way to allow it configurable to be either cover or contain?

@KyleAMathews
Copy link
Contributor

@jonathan-chin happy to take a PR to make gatsby-image more configurable.

@tsriram tsriram self-assigned this Feb 16, 2018
@tsriram
Copy link
Contributor

tsriram commented Feb 16, 2018

@KyleAMathews sounds okay to add a new prop imgStyle which can be spread into img element?

@KyleAMathews
Copy link
Contributor

@tsriram yeah, that'd be great!

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

4 participants