Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
Bit-Barron committed Sep 24, 2024
1 parent 04d026c commit 276d658
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,24 @@ export class AppController {
});
const imageBuffer = Buffer.from(response.data);

// Log the content type of the image
const contentType = response.headers['content-type'];
console.log(`Processing image: ${name}, Content-Type: ${contentType}`);

if (format === 'original') {
const contentType = response.headers['content-type'];
console.log(`Adding original image: ${name}, type: ${contentType}`);
zip.file(name, imageBuffer, { binary: true });
} else {
let sharpInstance = sharp(imageBuffer);
sharpInstance = sharpInstance.toFormat(format as any);
const processedImage = await sharpInstance.toBuffer();
console.log(`Adding converted image: ${name}.${format}`);
zip.file(`${name}.${format}`, processedImage, { binary: true });
}
}

const zipBuffer = await zip.generateAsync({ type: 'nodebuffer' });
console.log('ZIP file size:', zipBuffer.length);
console.log('ZIP file size:', zipBuffer.length, 'bytes');

reply
.header('Content-Type', 'application/zip')
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export const Images: React.FC = () => {
};
}, [handleTabChange]);

console.log(images);

if (loading) {
return (
<div className="flex justify-center items-center h-screen">
Expand Down

0 comments on commit 276d658

Please sign in to comment.