1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-11-04 23:10:13 +01:00

fix: disable image optimizations for logo to prevent caching issues with custom logos

This commit is contained in:
Elias Schneider 2023-10-09 10:40:55 +02:00
parent f15a8dc277
commit 38919003e9
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C
4 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,8 @@ const IMAGES_PATH = "../frontend/public/img";
@Injectable()
export class LogoService {
async create(file: Buffer) {
fs.writeFileSync(`${IMAGES_PATH}/logo.png`, file, "binary");
const resized = await sharp(file).resize(900).toBuffer();
fs.writeFileSync(`${IMAGES_PATH}/logo.png`, resized, "binary");
this.createFavicon(file);
this.createPWAIcons(file);
}
@ -25,7 +26,7 @@ export class LogoService {
fs.promises.writeFile(
`${IMAGES_PATH}/icons/icon-${size}x${size}.png`,
resized,
"binary",
"binary"
);
}
}

View File

@ -11,6 +11,7 @@
"react-hooks/exhaustive-deps": ["off"],
"import/no-anonymous-default-export": ["off"],
"no-unused-vars": ["warn"],
"react/no-unescaped-entities": ["off"]
"react/no-unescaped-entities": ["off"],
"@next/next/no-img-element": ["off"]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -1,6 +1,4 @@
import Image from "next/image";
const Logo = ({ height, width }: { height: number; width: number }) => {
return <Image src="/img/logo.png" alt="logo" height={height} width={width} />;
return <img src="/img/logo.png" alt="logo" height={height} width={width} />;
};
export default Logo;