From c369ccf1e0417fae4bb9c2eae818eec0b211b68c Mon Sep 17 00:00:00 2001 From: Pawel Wilk Date: Thu, 12 Oct 2017 13:39:10 +0200 Subject: [PATCH] webp support --- index.js | 7 ++++--- lib/ImageReducer.js | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b727f98..5a1f2a4 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,8 @@ * @created 2015/10/29 */ "use strict"; +process.env['PATH'] = '/var/task/lib/imagemagick/bin/:' + process.env['PATH']; +process.env['LD_LIBRARY_PATH'] = '/var/task/lib/imagemagick/lib/'; const ImageProcessor = require("./lib/ImageProcessor"); const S3FileSystem = require("./lib/S3FileSystem"); @@ -16,10 +18,9 @@ const path = require("path"); // Lambda Handler exports.handler = (event, context, callback) => { - var eventRecord = eventParser(event); if (eventRecord) { - process(eventRecord, callback); + processObject(eventRecord, callback); } else { console.log(JSON.stringify(event)); callback('Unsupported or invalid event'); @@ -27,7 +28,7 @@ exports.handler = (event, context, callback) => { } }; -function process(s3Object, callback) { +function processObject(s3Object, callback) { const configPath = path.resolve(__dirname, "config.json"); const fileSystem = new S3FileSystem(); const processor = new ImageProcessor(fileSystem, s3Object); diff --git a/lib/ImageReducer.js b/lib/ImageReducer.js index 14b7c85..f8b7dc5 100644 --- a/lib/ImageReducer.js +++ b/lib/ImageReducer.js @@ -80,6 +80,8 @@ class ImageReducer { case "gif": streams.push(new Gifsicle(args.gifsicle)); break; + case "webp": + break; default: throw new Error("Unexpected output type: " + type); }