Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media files resize #7737

Closed
2 tasks
dn-l opened this issue Jul 16, 2021 · 4 comments
Closed
2 tasks

Media files resize #7737

dn-l opened this issue Jul 16, 2021 · 4 comments
Assignees
Labels
feature-request Request a new feature p4

Comments

@dn-l
Copy link

dn-l commented Jul 16, 2021

Is this related to a new or existing Amplify category?

storage

Is this related to another service?

CloudFront, Lambda, S3

Describe the feature you'd like to request

Hey there!

It would be really great if CLI could set up and deploy infrastructure on top of S3 for media files resize. GCP has something like that out of the box, example (try to play with params at the end of the string):

https://lh3.googleusercontent.com/WmJJjWzS9MZbwP-aczHg_a9WtJINdcmbtfS4seC3dj0MNgTCkjEAJQPZ1gCvSknhhi5GaIF_l_TZ3WaEGJW1izqyaMKwbX5F9V7qewA=w600
https://lh3.googleusercontent.com/WmJJjWzS9MZbwP-aczHg_a9WtJINdcmbtfS4seC3dj0MNgTCkjEAJQPZ1gCvSknhhi5GaIF_l_TZ3WaEGJW1izqyaMKwbX5F9V7qewA=s300-c

AWS multiple times tried to suggest a solution for this problem (https://github.com/awslabs/serverless-image-handler and some other articles) which could be integrated into Amplify package in order to provide a full toolbox for a modern application.

Describe the solution you'd like

A very simple and bulletproof solution:

  1. A CLI deploys a CloudFront for serving and caching compiled images.
  2. A lambda function that resizes and converts an image to a better format (webp maybe)
  3. All that connects to storage created with CLI

For example, if a key of a gif file is "funny_cat.gif" then a correct URL to a CloudFront will return a resized and cropped (possibly with the use of AWS Rekognition to find a center) gif version of "funny_cat.gif" file stored in S3:
images.myapp.com/funny_cat.gif=s200-cthe
The result will be cached by CloudFront
If a file cannot be converted - the original file will be returned.
HTTP 404 in case the file was not found in S3.

Describe alternatives you've considered

https://github.com/awslabs/serverless-image-handler
https://uploadcare.com
https://cloudinary.com
https://cloud.google.com/appengine/docs/standard/go111/images

Additional context

There're many open-source projects that can be used for the transformation part:
https://github.com/uploadcare/pillow-simd?ref=stackshare
https://github.com/lovell/sharp/
https://github.com/libvips/libvips

In case S3 was set up to serve files based on IAM, auth should be taken into concern.

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@dn-l dn-l added the feature-request Request a new feature label Jul 16, 2021
@dn-l
Copy link
Author

dn-l commented Jul 16, 2021

cc @pananapread

@GeorgeBellTMH
Copy link

This would have been very useful....it took a lot of time to get my app setup to do this...

@dn-l
Copy link
Author

dn-l commented Jul 30, 2021

@renebrandel possible alternative solution for Nextjs applications - provide support of next/image hosted on Amplify https://nextjs.org/docs/basic-features/image-optimization

https://github.com/dealmore/terraform-aws-next-js-image-optimization

@ykethan ykethan added the p4 label Nov 3, 2022
@dn-l dn-l closed this as completed Mar 13, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature p4
Projects
None yet
Development

No branches or pull requests

4 participants