Last active
June 4, 2020 14:59
-
-
Save sadez/79707be1e2172f0f55c5dbbdb4926570 to your computer and use it in GitHub Desktop.
get url CDN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getURLFromCDN = (imageURL, height, quality) => { | |
// url formatting depend on CDN | |
return `${CDNimagePath}/${imageURL}?height=${Math.round(height)}&format=jpg&q=${quality}`; | |
}; | |
// render | |
<FastImage | |
source={{ uri: getURLFromCDN("https://url/image.png", 200, 80) }} // https://cdnurl/https://url/image.png?height=200&q=80&format=jpg | |
style={imgStyle} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment