lower case check

This commit is contained in:
Zutatensuppe 2021-04-21 10:15:08 +02:00
parent b6fd0b50ab
commit 6313ad257f
2 changed files with 4 additions and 4 deletions

View file

@ -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) const images = fs.readdirSync(dir)
images.forEach(async (image) => { images.forEach(async (image) => {
if (!image.match(/\.(jpe?g|webp|png)$/)) { if (!image.toLowerCase().match(/\.(jpe?g|webp|png)$/)) {
return return
} }
console.log(image) console.log(image)

View file

@ -44,7 +44,7 @@ async function getExifOrientation(imagePath) {
const resizeImage = async (filename) => { const resizeImage = async (filename) => {
const dir = `./../data/uploads/` const dir = `./../data/uploads/`
if (!filename.match(/\.(jpe?g|webp|png)$/)) { if (!filename.toLowerCase().match(/\.(jpe?g|webp|png)$/)) {
return return
} }
console.log(filename) console.log(filename)
@ -74,7 +74,7 @@ const resizeImage = async (filename) => {
const allImages = () => { const allImages = () => {
const images = fs.readdirSync('./../data/uploads/') 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 => ({ .map(f => ({
file: `./../data/uploads/${f}`, file: `./../data/uploads/${f}`,
url: `/uploads/${f}`, url: `/uploads/${f}`,