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
I had a problem showing pictures on some devices because I sent a number with decimal to width. It was so hard to debug because I couldn't reproduce the error anywhere. This was my code:
The text was updated successfully, but these errors were encountered:
predbjorn
changed the title
Bug / feature request: Send desimal in width/height in imagebuilder
Bug / feature request: Allow desimal in width/height in imagebuilder
Jan 10, 2020
I had a problem showing pictures on some devices because I sent a number with decimal to width. It was so hard to debug because I couldn't reproduce the error anywhere. This was my code:
imageUrlBuilder(sanityClient)
.image(this.state.sanity.mainImage)
.width(PixelRatio.getPixelSizeForLayoutSize(width))
.height(PixelRatio.getPixelSizeForLayoutSize(300))
.fit('crop')
.url();
It would be awesome if it did a Math.round(with) or something like that in the library.. So hard to debug if you get the error
My solution:
imageUrlBuilder(sanityClient)
.image(this.state.sanity.mainImage)
.width(Math.round(PixelRatio.getPixelSizeForLayoutSize(width)))
.height(Math.round(PixelRatio.getPixelSizeForLayoutSize(300)))
.fit('crop')
.url();
The text was updated successfully, but these errors were encountered: