@runnerpro/backend 1.6.26 → 1.6.28
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.
|
@@ -278,13 +278,18 @@ const resizeImage = (data, filePath, mimetype) => __awaiter(void 0, void 0, void
|
|
|
278
278
|
return rotateOrientationImage(data, image, null, mimetype);
|
|
279
279
|
});
|
|
280
280
|
const rotateOrientationImage = (data, filePath, image = null, mimetype) => __awaiter(void 0, void 0, void 0, function* () {
|
|
281
|
+
if (mimetype.includes('webp'))
|
|
282
|
+
return data;
|
|
281
283
|
if (!image)
|
|
282
284
|
image = yield jimp_1.default.read(filePath);
|
|
283
285
|
const orientation = yield exifr_1.default.orientation(data);
|
|
284
|
-
let rotate
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
let rotate;
|
|
287
|
+
if ([7, 8].includes(orientation))
|
|
288
|
+
rotate = 90;
|
|
289
|
+
else if ([3].includes(orientation))
|
|
290
|
+
rotate = 180;
|
|
291
|
+
else if ([5, 8].includes(orientation))
|
|
292
|
+
rotate = -90;
|
|
288
293
|
if (rotate)
|
|
289
294
|
image = yield image.rotate(rotate);
|
|
290
295
|
return image.getBufferAsync(jimp_1.default.MIME_JPEG);
|
|
@@ -38,7 +38,7 @@ const reduceSizeImage = (file, newWidth = 100, quality = 80) => __awaiter(void 0
|
|
|
38
38
|
const imageHeight = dimensions.height;
|
|
39
39
|
const newHeight = Math.round((imageHeight * newWidth) / imageWidth);
|
|
40
40
|
let image = yield jimp_1.default.read(filePath);
|
|
41
|
-
image = yield image
|
|
41
|
+
image = yield rotateOrientationImage(image);
|
|
42
42
|
image = yield image.resize(newWidth, newHeight);
|
|
43
43
|
image = yield image.quality(quality);
|
|
44
44
|
// @ts-ignore
|
|
@@ -57,3 +57,14 @@ const reduceSizeImage = (file, newWidth = 100, quality = 80) => __awaiter(void 0
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
exports.reduceSizeImage = reduceSizeImage;
|
|
60
|
+
const rotateOrientationImage = (image) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
// const orientation = await exifr.orientation(image);
|
|
62
|
+
// let rotate;
|
|
63
|
+
// if ([7, 8].includes(orientation)) rotate = 90;
|
|
64
|
+
// else if ([3].includes(orientation)) rotate = 180;
|
|
65
|
+
// else if ([5, 8].includes(orientation)) rotate = -90;
|
|
66
|
+
// if (rotate) image = await image.rotate(rotate);
|
|
67
|
+
// return image;
|
|
68
|
+
return image.rotate(90);
|
|
69
|
+
return image;
|
|
70
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAkBpD,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAkBpD,CAAC;AA0SF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reduceSizeImage.d.ts","sourceRoot":"","sources":["../../../../src/image/reduceSizeImage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reduceSizeImage.d.ts","sourceRoot":"","sources":["../../../../src/image/reduceSizeImage.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,eAAe,kEAqCpB,CAAC;AAeF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|