Skip to content

Commit

Permalink
fix: 이미지 리사이징 기능 임시적으로 주석 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed Jul 30, 2024
1 parent f4cc4d8 commit c7fe747
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/app/api/imageOptimize/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);

const src = searchParams.get('src');
const width = searchParams.get('width');
const height = searchParams.get('height');
// const width = searchParams.get('width');
// const height = searchParams.get('height');

if (!src || typeof src !== 'string') {
return new NextResponse('Missing or invalid "src" query parameter', {
status: 400,
});
}

const widthInt = width ? parseInt(width as string, 10) : null;
const heightInt = height ? parseInt(height as string, 10) : null;
// const widthInt = width ? parseInt(width as string, 10) : null;
// const heightInt = height ? parseInt(height as string, 10) : null;
const isGif = src.endsWith('.gif');

const getImageBuffer = async () => {
Expand Down Expand Up @@ -50,10 +50,10 @@ export async function GET(request: NextRequest) {
? sharp(imageBuffer, { animated: true }).gif()
: sharp(imageBuffer).webp();

// 이미지 리사이징
if (widthInt || heightInt) {
image.resize(widthInt, heightInt);
}
// // 이미지 리사이징
// if (widthInt || heightInt) {
// image.resize(widthInt, heightInt);
// }

const optimizedImageBuffer = await image.toBuffer();

Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const Image = ({
}: ImageProps) => {
const params = new URLSearchParams({ src });

if (width) params.append('width', width.toString());
if (height) params.append('height', height.toString());
// if (width) params.append('width', width.toString());
// if (height) params.append('height', height.toString());

const optimizedSrc = `/api/imageOptimize?${params.toString()}`;

Expand Down

0 comments on commit c7fe747

Please sign in to comment.