diff --git a/src/transformers/cloudinary.test.ts b/src/transformers/cloudinary.test.ts index b724836..59cf963 100644 --- a/src/transformers/cloudinary.test.ts +++ b/src/transformers/cloudinary.test.ts @@ -123,7 +123,7 @@ Deno.test("cloudinary transformer", async (t) => { }); assertEquals( result?.toString(), - "https://res.cloudinary.com/demo/image/upload/w_100,h_200,f_auto/dog", + "https://res.cloudinary.com/demo/image/upload/w_100,h_200,c_lfill,f_auto/dog", ); }); diff --git a/src/transformers/cloudinary.ts b/src/transformers/cloudinary.ts index 5622682..3acf67c 100644 --- a/src/transformers/cloudinary.ts +++ b/src/transformers/cloudinary.ts @@ -71,7 +71,7 @@ export const parse: UrlParser = ( const group = matches[0].groups || {}; const { - transformations: transformString, + transformations: transformString = "", format: originalFormat, ...baseParams } = group; @@ -104,13 +104,15 @@ export const generate: UrlGenerator = ( ...params, format: format || "auto", }; - if (width) { props.transformations.w = roundIfNumeric(width).toString(); } if (height) { props.transformations.h = roundIfNumeric(height).toString(); } + + // Default crop to fill without upscaling + props.transformations.c ||= "lfill"; return new URL(formatUrl(props)); }; diff --git a/src/transformers/storyblok.test.ts b/src/transformers/storyblok.test.ts index e317f2f..97357d5 100644 --- a/src/transformers/storyblok.test.ts +++ b/src/transformers/storyblok.test.ts @@ -20,7 +20,7 @@ Deno.test("storyblok parser", async (t) => { for (const image of images) { await t.step(image, () => { const res = parse(image); - console.log(res); + // console.log(res); }); // await t.step(original, () => { // const { params, ...parsed } = parse(original ) as any;