@pronto-tools-and-more/custom-js-functions 15.10.0 → 15.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js
CHANGED
@@ -592,7 +592,7 @@
|
|
592
592
|
};
|
593
593
|
|
594
594
|
// src/parts/GetOptimizedImageSrc/GetOptimizedImageSrc.ts
|
595
|
-
var getOptimizedImageSrc = (src, webp, width) => {
|
595
|
+
var getOptimizedImageSrc = (src, webp, width, resize) => {
|
596
596
|
let params = [];
|
597
597
|
if (webp) {
|
598
598
|
params.push("webp=1");
|
@@ -600,6 +600,11 @@
|
|
600
600
|
if (width) {
|
601
601
|
params.push(`w=${width}`);
|
602
602
|
}
|
603
|
+
if (resize) {
|
604
|
+
console.log({ resize, src, webp, width });
|
605
|
+
params.push(`resize=${resize}`);
|
606
|
+
params.push("crop_strategy=attention");
|
607
|
+
}
|
603
608
|
const paramsString = params.join("&");
|
604
609
|
if (paramsString) {
|
605
610
|
return `${src}?${paramsString}`;
|
package/package.json
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
export const getOptimizedImageSrc = (
|
2
2
|
src: string,
|
3
3
|
webp?: boolean,
|
4
|
-
width?: number
|
4
|
+
width?: number,
|
5
|
+
resize?: string
|
5
6
|
): string => {
|
6
7
|
let params: string[] = [];
|
7
8
|
if (webp) {
|
@@ -10,6 +11,11 @@ export const getOptimizedImageSrc = (
|
|
10
11
|
if (width) {
|
11
12
|
params.push(`w=${width}`);
|
12
13
|
}
|
14
|
+
if (resize) {
|
15
|
+
console.log({ resize, src, webp, width });
|
16
|
+
params.push(`resize=${resize}`);
|
17
|
+
params.push("crop_strategy=attention");
|
18
|
+
}
|
13
19
|
const paramsString = params.join("&");
|
14
20
|
if (paramsString) {
|
15
21
|
return `${src}?${paramsString}`;
|