Skip to content

Commit 106f263

Browse files
chore(draft): use image metadata instead of file extension to determine image format;
1 parent 86b8d06 commit 106f263

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/updateData.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ const addImageMetadata = async (sponsors) => {
235235
const {image} = sponsor;
236236
if(!image) return;
237237
try {
238-
const {width, height} = await sharp('.' + image).metadata();
238+
const {width, height, format} = await sharp('.' + image).metadata();
239239

240240
sponsor.imageWidth = width;
241241
sponsor.imageHeight = height;
242242
sponsor.isWideImage = sponsor.showCaption === undefined && width > height * 1.8;
243-
sponsor.imageType = path.extname(image).toLowerCase().slice(1);
243+
sponsor.imageType = format;
244244
} catch(err) {
245245
console.log(`Error while reading image metadata [${image}]: ${err}`);
246246
}

0 commit comments

Comments
 (0)