@tradly/asset 1.0.11 → 1.0.13
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.
|
@@ -70,7 +70,14 @@ var compressImage = function compressImage(file) {
|
|
|
70
70
|
resolve(file);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
// If we converted to WebP, normalize extension in the file name
|
|
75
|
+
var newName = file.name;
|
|
76
|
+
if (targetType === "image/webp") {
|
|
77
|
+
var dotIndex = file.name.lastIndexOf(".");
|
|
78
|
+
newName = dotIndex > 0 ? "".concat(file.name.slice(0, dotIndex), ".webp") : "".concat(file.name, ".webp");
|
|
79
|
+
}
|
|
80
|
+
var compressedFile = new File([blob], newName, {
|
|
74
81
|
type: targetType,
|
|
75
82
|
lastModified: Date.now()
|
|
76
83
|
});
|
|
@@ -140,7 +147,8 @@ var FileUpload = function FileUpload(_ref2) {
|
|
|
140
147
|
return compressImage(file, {
|
|
141
148
|
maxWidth: 1600,
|
|
142
149
|
maxHeight: 1600,
|
|
143
|
-
quality:
|
|
150
|
+
quality: 0.95,
|
|
151
|
+
convertToWebp: true
|
|
144
152
|
});
|
|
145
153
|
}));
|
|
146
154
|
case 2:
|
|
@@ -64,7 +64,14 @@ var compressImage = function compressImage(file) {
|
|
|
64
64
|
resolve(file);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
// If we converted to WebP, normalize extension in the file name
|
|
69
|
+
var newName = file.name;
|
|
70
|
+
if (targetType === "image/webp") {
|
|
71
|
+
var dotIndex = file.name.lastIndexOf(".");
|
|
72
|
+
newName = dotIndex > 0 ? "".concat(file.name.slice(0, dotIndex), ".webp") : "".concat(file.name, ".webp");
|
|
73
|
+
}
|
|
74
|
+
var compressedFile = new File([blob], newName, {
|
|
68
75
|
type: targetType,
|
|
69
76
|
lastModified: Date.now()
|
|
70
77
|
});
|
|
@@ -134,7 +141,8 @@ var FileUpload = function FileUpload(_ref2) {
|
|
|
134
141
|
return compressImage(file, {
|
|
135
142
|
maxWidth: 1600,
|
|
136
143
|
maxHeight: 1600,
|
|
137
|
-
quality:
|
|
144
|
+
quality: 0.95,
|
|
145
|
+
convertToWebp: true
|
|
138
146
|
});
|
|
139
147
|
}));
|
|
140
148
|
case 2:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradly/asset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "A reusable media gallery component for uploading and selecting images, videos, and files with Tradly authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|