mirror of
https://github.com/immich-app/immich.git
synced 2026-03-04 09:57:33 +03:00
fix(server): thumbnail rotation when using embedded previews (#13948)
This commit is contained in:
@@ -5,6 +5,7 @@ import { Duration } from 'luxon';
|
||||
import fs from 'node:fs/promises';
|
||||
import { Writable } from 'node:stream';
|
||||
import sharp from 'sharp';
|
||||
import { ORIENTATION_TO_SHARP_ROTATION } from 'src/constants';
|
||||
import { Colorspace, LogLevel } from 'src/enum';
|
||||
import { ILoggerRepository } from 'src/interfaces/logger.interface';
|
||||
import {
|
||||
@@ -82,7 +83,15 @@ export class MediaRepository implements IMediaRepository {
|
||||
.withIccProfile(options.colorspace);
|
||||
|
||||
if (!options.raw) {
|
||||
pipeline = pipeline.rotate();
|
||||
const { angle, flip, flop } = options.orientation ? ORIENTATION_TO_SHARP_ROTATION[options.orientation] : {};
|
||||
pipeline = pipeline.rotate(angle);
|
||||
if (flip) {
|
||||
pipeline = pipeline.flip();
|
||||
}
|
||||
|
||||
if (flop) {
|
||||
pipeline = pipeline.flop();
|
||||
}
|
||||
}
|
||||
|
||||
if (options.crop) {
|
||||
|
||||
Reference in New Issue
Block a user