@runnerpro/backend 1.6.18 → 1.6.19
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.
|
@@ -227,7 +227,7 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, query, isClie
|
|
|
227
227
|
if (req.file.mimetype.includes('image')) {
|
|
228
228
|
try {
|
|
229
229
|
const fileDataResize = yield resizeImage(fileData, filePath, req.file.mimetype);
|
|
230
|
-
const fileDataOriented = yield
|
|
230
|
+
const fileDataOriented = yield rotateOrientationImage(fileData, filePath, null, req.file.mimetype);
|
|
231
231
|
files.push({ data: fileDataResize, id: idFile });
|
|
232
232
|
files.push({ data: fileDataOriented, id: `${idFile}-original` });
|
|
233
233
|
}
|
|
@@ -275,24 +275,23 @@ const resizeImage = (data, filePath, mimetype) => __awaiter(void 0, void 0, void
|
|
|
275
275
|
const newHeight = Math.round((imageHeight * newWidth) / imageWidth);
|
|
276
276
|
let image = yield jimp_1.default.read(filePath);
|
|
277
277
|
image = yield image.resize(newWidth, newHeight);
|
|
278
|
-
return
|
|
278
|
+
return rotateOrientationImage(data, image, null, mimetype);
|
|
279
279
|
});
|
|
280
|
-
const
|
|
280
|
+
const rotateOrientationImage = (data, filePath, image = null, mimetype) => __awaiter(void 0, void 0, void 0, function* () {
|
|
281
281
|
if (mimetype.includes('webp'))
|
|
282
282
|
return data;
|
|
283
283
|
if (!image)
|
|
284
284
|
image = yield jimp_1.default.read(filePath);
|
|
285
285
|
const orientation = yield exifr_1.default.orientation(data);
|
|
286
|
-
let rotate
|
|
287
|
-
if (orientation
|
|
286
|
+
let rotate;
|
|
287
|
+
if ([7, 8].includes(orientation))
|
|
288
288
|
rotate = 90;
|
|
289
|
-
else if (orientation
|
|
290
|
-
rotate = -90;
|
|
291
|
-
else if (orientation === 3)
|
|
289
|
+
else if ([3].includes(orientation))
|
|
292
290
|
rotate = 180;
|
|
293
|
-
if (
|
|
291
|
+
else if ([5, 8].includes(orientation))
|
|
292
|
+
rotate = -90;
|
|
293
|
+
if (rotate)
|
|
294
294
|
image = yield image.rotate(rotate);
|
|
295
|
-
}
|
|
296
295
|
return image.getBufferAsync(jimp_1.default.MIME_JPEG);
|
|
297
296
|
});
|
|
298
297
|
const saveResponseTime = ({ query, isClient, idCliente }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -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"}
|