diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-16x16.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-16x16.png new file mode 100644 index 000000000..ea8e678a6 Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-16x16.png differ diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-320x240.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-320x240.png new file mode 100644 index 000000000..a86b4fd51 Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-320x240.png differ diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-640x480.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-640x480.png new file mode 100644 index 000000000..953735f6d Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1-640x480.png differ diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1.png new file mode 100644 index 000000000..2c7cffa1f Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-1.png differ diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-16x16.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-16x16.png new file mode 100644 index 000000000..ea8e678a6 Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-16x16.png differ diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-320x240.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-320x240.png new file mode 100644 index 000000000..a86b4fd51 Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-320x240.png differ diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-640x480.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-640x480.png new file mode 100644 index 000000000..953735f6d Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM-640x480.png differ diff --git a/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM.png b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM.png new file mode 100644 index 000000000..2c7cffa1f Binary files /dev/null and b/demo/media/Screen Shot 2020-05-05 at 12.54.27 PM.png differ diff --git a/src/uploads/imageResizer.js b/src/uploads/imageResizer.js index 4e12d44d5..a33d17609 100644 --- a/src/uploads/imageResizer.js +++ b/src/uploads/imageResizer.js @@ -18,7 +18,7 @@ function getOutputImage(sourceImage, size) { }; } -module.exports = async function resizeAndSave(config, uploadConfig, savedFilename) { +module.exports = async function resizeAndSave(config, savedFilename) { /** * Resize images according to image desired width and height and return sizes * @param config Object @@ -27,11 +27,13 @@ module.exports = async function resizeAndSave(config, uploadConfig, savedFilenam * @returns String[] */ - const sourceImage = `${config.staticDir}/${savedFilename}`; + const { imageSizes, staticDir } = config.upload; + + const sourceImage = `${staticDir}/${savedFilename}`; let sizes; try { const dimensions = await sizeOf(sourceImage); - sizes = uploadConfig.imageSizes + sizes = imageSizes .filter(desiredSize => desiredSize.width < dimensions.width) .map(async (desiredSize) => { const outputImage = getOutputImage(savedFilename, desiredSize); @@ -41,7 +43,7 @@ module.exports = async function resizeAndSave(config, uploadConfig, savedFilenam // would it make sense for this to be set by the uploader? position: desiredSize.crop || 'centre', }) - .toFile(`${config.staticDir}/${imageNameWithDimensions}`); + .toFile(`${staticDir}/${imageNameWithDimensions}`); return { ...desiredSize, filename: imageNameWithDimensions }; }); const savedSizes = await Promise.all(sizes);