fix: resolve typescript compilation error with sharp buffer in thumbnail handler
This commit is contained in:
1 parent
7e85b35486
commit
fe2f82244d
1 file changed
+5
-8
@@ -115,20 +115,17 @@ async function watermarkedThumbnailResponse(thumbnail: ImmichBinary, assetId: st
|
||||
const buffer = Buffer.concat(chunks);
|
||||
|
||||
// Skaliere das Bild auf 480px Breite (wie vom User gewünscht)
|
||||
const targetWidth = 480;
|
||||
const resizedBuffer = await sharp(buffer)
|
||||
.resize({ width: targetWidth, withoutEnlargement: true })
|
||||
let watermarked = buffer;
|
||||
try {
|
||||
const logoPath = path.join(process.cwd(), "public", "brand", "logo-white.png");
|
||||
const logoBuffer = await fs.readFile(logoPath);
|
||||
|
||||
// Skaliere das Bild so, dass es in eine 800x800 Box passt (damit Hoch- und Querformat korrekt skaliert werden)
|
||||
const targetSize = 800;
|
||||
const resizedBuffer = await sharp(buffer)
|
||||
.resize({ width: targetSize, height: targetSize, fit: "inside", withoutEnlargement: true })
|
||||
.toBuffer();
|
||||
|
||||
let watermarked = resizedBuffer;
|
||||
try {
|
||||
const logoPath = path.join(process.cwd(), "public", "brand", "logo-white.png");
|
||||
const logoBuffer = await fs.readFile(logoPath);
|
||||
|
||||
const { width, height } = await sharp(resizedBuffer).metadata();
|
||||
|
||||
// Berechne Wasserzeichen-Größe (50% der Bildbreite, max 400px)
|
||||
|
||||
Reference in new issue
Block a user