I'm trying to fill a div with array of images using
fluid{
...GatsbyContentfulFluid
}
everything works fine except that gatsby stretches images smaller than a div width to fill out whole space (which he suppose to) but my question is if I can prevent this and for those images use 100% of their width without stretching them and only apply fluid to bigger images.
gatsby-image plugin says that I can use GatsbyImageSharpFluidLimitPresentationSize fragment
but this does not work with contentful
Is there an easy fix? Thanks
You have a few trials to bypass it based on your requirements:
As you said, Contentful doesn't allow
GatsbyImageSharpFluidLimitPresentationSizefragment, however, you can download the asset with thedownloadLocal: trueplugin option, and apply astaticQuerywith theGatsbyImageSharpFluidLimitPresentationSizefragment. I would look something like:Another option, which may require more treatment (mediaqueries and CSS effort) is to use one of the fixed-size fragments that are allowed by Contentful.