diff --git a/apps/nextjs/package.json b/apps/nextjs/package.json index e7108e4..602eb5d 100644 --- a/apps/nextjs/package.json +++ b/apps/nextjs/package.json @@ -31,7 +31,6 @@ "@types/react": "18.0.19", "@types/react-dom": "18.0.6", "@types/react-test-renderer": "18.0.0", - "@types/sharp": "0.31.0", "@vitejs/plugin-react": "2.1.0", "autoprefixer": "10.4.9", "eslint": "8.23.1", diff --git a/libs/backend/infrastructure/controllers/images.controller.ts b/libs/backend/infrastructure/controllers/images.controller.ts index 1b47e16..2d0171f 100644 --- a/libs/backend/infrastructure/controllers/images.controller.ts +++ b/libs/backend/infrastructure/controllers/images.controller.ts @@ -1,6 +1,6 @@ import assert from 'assert'; import { NextApiRequest, NextApiResponse } from 'next'; -// import sharp from 'sharp'; +import sharp from 'sharp'; import { findOneByNameBucket } from '../../application'; export async function getImageByNameController( @@ -19,16 +19,14 @@ export async function getImageByNameController( fileName.replace(/.webp$/, '.png') ); - // const output = sharp().webp({ quality: 80 }).resize({ - // fit: 'contain', - // width: 300, - // height: 300, - // }); + const output = sharp().webp({ quality: 80 }).resize({ + fit: 'contain', + width: 300, + height: 300, + }); - // res.setHeader('Content-Type', 'image/webp'); - file - // .pipe(output) - .pipe(res); + res.setHeader('Content-Type', 'image/webp'); + file.pipe(output).pipe(res); } export async function getCoverByNameController( @@ -44,19 +42,17 @@ export async function getCoverByNameController( fileName.replace(/.webp$/, '.png') ); - // const output = sharp() - // .webp({ quality: 80 }) - // .resize({ - // fit: 'cover', - // width: 1280, - // height: 720, - // }) - // .extend({ - // background: { r: 255, g: 255, b: 255, alpha: 0.8 }, - // }); - - // res.setHeader('Content-Type', 'image/webp'); - file - // .pipe(output) - .pipe(res); + const output = sharp() + .webp({ quality: 80 }) + .resize({ + fit: 'cover', + width: 1280, + height: 720, + }) + .extend({ + background: { r: 255, g: 255, b: 255, alpha: 0.8 }, + }); + + res.setHeader('Content-Type', 'image/webp'); + file.pipe(output).pipe(res); } diff --git a/libs/frontend/infrastructure/components/featured-card.tsx b/libs/frontend/infrastructure/components/featured-card.tsx index 6d792b2..15690b2 100644 --- a/libs/frontend/infrastructure/components/featured-card.tsx +++ b/libs/frontend/infrastructure/components/featured-card.tsx @@ -14,7 +14,7 @@ export default function FeaturedCard() {