Skip to content

Instantly share code, notes, and snippets.

@adica
Created August 8, 2017 11:57
Show Gist options
  • Save adica/090bb13bdb345a337ec92cf510d557ec to your computer and use it in GitHub Desktop.
Save adica/090bb13bdb345a337ec92cf510d557ec to your computer and use it in GitHub Desktop.
//exaple create new
var url = 'https://img.playbuzz.com/image/upload/v1482669775/iiilhdzd5gpore2a5buz.jpg';
var optimizeTransformation = {
quality: 'auto',
fetch_format: 'auto',
flags: 'lossy'
};
var result = your_new_cloudinary_function(url, optimizeTransformation);
// result should be: 'https://img.playbuzz.com/image/upload/f_auto,fl_lossy,q_auto/v1482669775/iiilhdzd5gpore2a5buz.jpg'
// adding to existing
var url2 = 'https://img.playbuzz.com/image/upload/f_auto,fl_lossy,q_auto/v1502151920/gh3bbrepicumpdsj9i0o.jpg';
var optimizeTransformation2 = {
width: 640,
crop: 'limit'
};
var result2 = your_new_cloudinary_function(url2, optimizeTransformation2);
// result2 should be: 'https://img.playbuzz.com/image/upload/f_auto,fl_lossy,q_auto/c_limit,w_640/v1502151920/gh3bbrepicumpdsj9i0o.jpg'
// the transformations we use can be:
// quality, fetch_format, flags, crop, width, height, asspect-ratio
// and would like to use all that cloudinary have to offer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment