diff --git a/imports/util/cloudinary-transformations.js b/imports/util/cloudinary-transformations.js index 61dbdada..32e6e538 100644 --- a/imports/util/cloudinary-transformations.js +++ b/imports/util/cloudinary-transformations.js @@ -1,4 +1,8 @@ -const generalReplacer = (url, paramsStr) => url.replace(/\/upload\/[^/]*\//, `/upload/${paramsStr}/`) +// https://cloudinary.com/documentation/image_transformations#automatic_format_selection +const defaultTransform = 'f_auto' + +const generalReplacer = (url, paramsStr) => url.replace(/\/upload\/[^/]*\//, + `/upload/${defaultTransform + (paramsStr ? ',' + paramsStr : '')}/`) export const matchWidth = (url, pixelWidth) => generalReplacer(url, `w_${pixelWidth}`) export const fitDimensions = (url, pixelWidth, pixelHeight) =>