Created
January 26, 2025 14:51
-
-
Save jarrodmedrano/b4c1052bd9b3417d8a1f932cffef5417 to your computer and use it in GitHub Desktop.
Cloudinary resize
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 cld = new Cloudinary({ | |
cloud: { | |
cloudName: "slashclick", | |
}, | |
}); | |
const myImage = cld.image(popout); | |
const srcSetOptions = [ | |
{ width: 200, transformation: scale().width(200) }, | |
{ width: 400, transformation: scale().width(400) }, | |
{ width: 600, transformation: scale().width(600) }, | |
{ width: 800, transformation: scale().width(800) }, | |
]; | |
const srcSet = srcSetOptions.map((opt) => ({ | |
src: cld.image(popout).resize(opt.transformation).quality("auto").toURL(), | |
width: opt.width, | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment