Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class AttachmentsStorageService {
) {
const mimetype = ATTACHMENT_THUMBNAIL_DEFAULT_MIMETYPE;
const { smThumbnailPath, lgThumbnailPath } = generateTableThumbnailPath(path);
const image = sharp(imageBuffer, { failOn: 'none', unlimited: true });
const image = sharp(imageBuffer, { failOn: 'none', unlimited: true }).rotate();
let cutSmThumbnailPath: string | undefined;
let cutLgThumbnailPath: string | undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export class LocalStorage implements StorageAdapter {
},
});
}
const resizedImage = image.resize(width, height);
const resizedImage = image.rotate().resize(width, height);
await resizedImage.toFile(resizedImagePath);
return newPath;
}
Expand Down
7 changes: 3 additions & 4 deletions apps/nestjs-backend/src/features/attachments/plugins/minio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,9 @@ export class MinioStorage implements StorageAdapter {
writeStream.removeAllListeners();
writeStream.destroy();
}
const metaReader = sharp(sourceFilePath, { failOn: 'none', unlimited: true }).resize(
width,
height
);
const metaReader = sharp(sourceFilePath, { failOn: 'none', unlimited: true })
.rotate()
.resize(width, height);
await metaReader.toFile(resizedImagePath);
// delete source file
fse.removeSync(sourceFilePath);
Expand Down
7 changes: 3 additions & 4 deletions apps/nestjs-backend/src/features/attachments/plugins/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,9 @@ export class S3Storage implements StorageAdapter {
writeStream.on('error', reject);
(stream as Readable).on('error', reject);
});
const metaReader = sharp(sourceFilePath, { failOn: 'none', unlimited: true }).resize(
width,
height
);
const metaReader = sharp(sourceFilePath, { failOn: 'none', unlimited: true })
.rotate()
.resize(width, height);
await metaReader.toFile(resizedImagePath);
fse.removeSync(sourceFilePath);
const upload = await this.uploadFileWidthPath(bucket, newPath, resizedImagePath, {
Expand Down