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() {
diff --git a/libs/frontend/infrastructure/features/components/celebrity.tsx b/libs/frontend/infrastructure/features/components/celebrity.tsx index e7e4192..117fc58 100644 --- a/libs/frontend/infrastructure/features/components/celebrity.tsx +++ b/libs/frontend/infrastructure/features/components/celebrity.tsx @@ -33,10 +33,8 @@ export default function Celebrity({ celebrity, listOption }: CelebrityProps) { 'sm:object-cover sm:w-full sm:h-full': isList, })} objectFit={isList ? 'contain' : 'fill'} - // layout="fill" + layout="fill" objectPosition={isList ? 'left' : 'center'} - width={300} - height={300} />
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e3b855d..73c22bb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,9 +69,6 @@ importers: '@types/react-test-renderer': specifier: 18.0.0 version: 18.0.0 - '@types/sharp': - specifier: 0.31.0 - version: 0.31.0 '@vitejs/plugin-react': specifier: 2.1.0 version: 2.1.0(vite@3.2.10) @@ -1579,12 +1576,6 @@ packages: /@types/scheduler@0.23.0: resolution: {integrity: sha512-YIoDCTH3Af6XM5VuwGG/QL/CJqga1Zm3NkU3HZ4ZHK2fRMPYP1VczsTUqtsf43PH/iJNVlPHAo2oWX7BSdB2Hw==} - /@types/sharp@0.31.0: - resolution: {integrity: sha512-nwivOU101fYInCwdDcH/0/Ru6yIRXOpORx25ynEOc6/IakuCmjOAGpaO5VfUl4QkDtUC6hj+Z2eCQvgXOioknw==} - dependencies: - '@types/node': 18.7.16 - dev: true - /@types/webidl-conversions@7.0.3: resolution: {integrity: sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==} dev: false