Skip to content

Commit

Permalink
webp support
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Wilk committed Oct 12, 2017
1 parent 513c53b commit c369ccf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -16,18 +18,17 @@ 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');
return;
}
};

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);
Expand Down
2 changes: 2 additions & 0 deletions lib/ImageReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c369ccf

Please sign in to comment.