I need to resize my images before I upload them to s3 (amazon). I tried this function but it\'s not working.
Here is the function that uploads the image.
My
In your example you're saving the image to S3 (s3.putObject
) before resizing it (im.resize
). Move the resize function before the put.
You're also not passing the image to the resize function; you'll need something like
im.resize(fileStream, { // pass in the image
height:100,
width: 200
}, function(err, stdout, stderr){
if (err) throw err;
console.log('resized image to fit within 200x200px');
});
Check the docs for the library you're using for the correct syntax.