diff --git a/scripts/resize_images.js b/scripts/resize_images.js index cd83fdd..ee3ad0e 100755 --- a/scripts/resize_images.js +++ b/scripts/resize_images.js @@ -16,10 +16,10 @@ async function getExifOrientation(imagePath) { }) } -const dir = `${process.env.RUN_DIR}/data/uploads` +const dir = `./../data/uploads` const images = fs.readdirSync(dir) images.forEach(async (image) => { - if (!image.match(/\.(jpe?g|webp|png)$/)) { + if (!image.toLowerCase().match(/\.(jpe?g|webp|png)$/)) { return } console.log(image) diff --git a/server/index.js b/server/index.js index a4c4670..e035c98 100644 --- a/server/index.js +++ b/server/index.js @@ -44,7 +44,7 @@ async function getExifOrientation(imagePath) { const resizeImage = async (filename) => { const dir = `./../data/uploads/` - if (!filename.match(/\.(jpe?g|webp|png)$/)) { + if (!filename.toLowerCase().match(/\.(jpe?g|webp|png)$/)) { return } console.log(filename) @@ -74,7 +74,7 @@ const resizeImage = async (filename) => { const allImages = () => { const images = fs.readdirSync('./../data/uploads/') - .filter(f => f.match(/\.(jpe?g|webp|png)$/)) + .filter(f => f.toLowerCase().match(/\.(jpe?g|webp|png)$/)) .map(f => ({ file: `./../data/uploads/${f}`, url: `/uploads/${f}`,