You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace original images with reduced and resized image #206
In order to replace the original image, it has to be done like that. I had lots of problems with overlapping event paths because Amazon doesn't allow for exclusions or wildcards in the path of events.
But this works well enough. The only code change I had to make was in lib/S3FileSystem.js where I removed at line 24:
if ( "img-processed" in data.Metadata ) {
reject("Object was already processed.");
} else
I instead of looking for img-processed, I think this code ought to write and check for the ARN of the lambda. Normally I would make a PR, but I have to roll on.
I also think a great improvement would be allowing events to chain. I feel like this library is great, but ultimately one wants an image that is both resized and reduced in the end--if one wants to resize it at all.
It would also be great if the original file could be replaced. For instance, we return a URL to users after they upload their file, so we have to replace the original.
Activity
glassdimlygr commentedon Aug 3, 2020
I created two lambdas, the first with a reduce task that watches
/mysubdir/.jpg(for a simplified example) and moves it to/reduced/The second watches
reduced/.jpg, resizes, and then moves to/mysubdir/, resizing to 100px max width (for example)In order to replace the original image, it has to be done like that. I had lots of problems with overlapping event paths because Amazon doesn't allow for exclusions or wildcards in the path of events.
But this works well enough. The only code change I had to make was in
lib/S3FileSystem.jswhere I removed at line 24:I instead of looking for
img-processed, I think this code ought to write and check for the ARN of the lambda. Normally I would make a PR, but I have to roll on.I also think a great improvement would be allowing events to chain. I feel like this library is great, but ultimately one wants an image that is both resized and reduced in the end--if one wants to resize it at all.
It would also be great if the original file could be replaced. For instance, we return a URL to users after they upload their file, so we have to replace the original.