Last active
May 3, 2022 22:19
-
-
Save matiasfha/27fc927bfcc63416e2602aedbf73f423 to your computer and use it in GitHub Desktop.
createSharingImage utility function using cloudinary transformations
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 createSharingImage = ({ cloudName, text }) => { | |
const imageTransformations = [ | |
'w_1200', | |
'h_627', | |
'c_fill', | |
'q_auto', | |
'f_auto' | |
].join(',') | |
const textTransformations = [ | |
'w_600', | |
'x_480', | |
'y_254', | |
'g_south_west', | |
'co_white', | |
`l_text:roboto_64:${encodeURIComponent(text)}` | |
].join(',') | |
const baseUrl = `https://res.cloudinary.com/${cloudName}/image/upload/` | |
return `${baseUrl}${imageTransformations}/${textTransformations}/example_social_card.jpg` | |
} | |
export default createSharingImage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment