Skip to content

Commit

Permalink
style: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
zdimension committed Aug 14, 2024
1 parent a42c112 commit 340bc0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions server/src/repositories/media.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export class MediaRepository implements IMediaRepository {

async generateThumbnail(input: string | Buffer, output: string, options: ThumbnailOptions): Promise<void> {
// some invalid images can still be processed by sharp, but we want to fail on them by default to avoid crashes
const pipeline = sharp(input, { failOn: options.processInvalidImages ? 'none' : 'error', limitInputPixels: false })
.pipelineColorspace(options.colorspace === Colorspace.SRGB ? 'srgb' : 'rgb16')
const pipeline = sharp(input, {
failOn: options.processInvalidImages ? 'none' : 'error',
limitInputPixels: false,
}).pipelineColorspace(options.colorspace === Colorspace.SRGB ? 'srgb' : 'rgb16');

if (options.mirror) {
pipeline.flop();
Expand Down
16 changes: 9 additions & 7 deletions server/src/services/media.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class MediaService {
quality: image.quality,
processInvalidImages: process.env.IMMICH_PROCESS_INVALID_IMAGES === 'true',
angle: 0,
mirror: false
mirror: false,
};

if (asset.exifInfo?.orientation) {
Expand All @@ -231,12 +231,14 @@ export class MediaService {
break;
}

if ([
ExifOrientation.MirrorHorizontal,
ExifOrientation.MirrorVertical,
ExifOrientation.MirrorHorizontalRotate90CW,
ExifOrientation.MirrorHorizontalRotate270CW,
].includes(asset.exifInfo.orientation as ExifOrientation)) {
if (
[
ExifOrientation.MirrorHorizontal,
ExifOrientation.MirrorVertical,
ExifOrientation.MirrorHorizontalRotate90CW,
ExifOrientation.MirrorHorizontalRotate270CW,
].includes(asset.exifInfo.orientation as ExifOrientation)
) {
imageOptions.mirror = true;
}
}
Expand Down

0 comments on commit 340bc0f

Please sign in to comment.