Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jhcoll committed Nov 9, 2023
1 parent 423fcd7 commit 884f878
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions scripts/images/resize-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ const fs = require("fs");
});

for (const path of paths) {
const { data, info } = await sharp(path)
.resize(1140, 1140, {fit: 'inside', withoutEnlargement: true})
.toBuffer({ resolveWithObject: true });
try{
console.log('Resizing image: ', path);
const { data, info } = await sharp(path)
.resize(1140, 1140, {fit: 'inside', withoutEnlargement: true})
.toBuffer({ resolveWithObject: true });

console.log('Size after resize: width - ', info.width, ', height - ', info.height, ', size - ', info.size);

await fs.promises.writeFile(path, data);
await fs.promises.writeFile(path, data);
} catch (err) {
console.log('failed to resize image: ', path);
throw err;
}
}
})();

0 comments on commit 884f878

Please sign in to comment.