-
Notifications
You must be signed in to change notification settings - Fork 14
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
Optimization: Images Processing #1128
Labels
enhancement
New feature or request
Comments
robertu7
changed the title
Optimization: Processing User Uploaded Images
Optimization: Images Processing
Jun 1, 2020
Great summary! One question I have in mind is, what do we display in editor after user upload image? Do we need to wait for image process to insert the image path, or should we get some placeholder first and replace it later? |
Fallback image for broken link: https://medium.com/@webcore1/react-fallback-for-broken-images-strategy-a8dfa9c1be1e |
This was referenced Jun 15, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
We have lots of images uploaded by users: avatars, profile covers, article embedded images, and etc. Based on Lighthouse Report, images have big negative impact for performance score:
In general, there are three sides to be optimzed:
Source
Application
Proxy
Solutions
Currently, we will do simple image processing (compressing & resizing) in
connectors/aws
, while image uploading. But there are cons:Lambda To Rescue!
With AWS Lambda, processing image will be asynchronously and separately. There are two ways to implement:
1) Lazy processing
Use Serverless Image Handler, process image on client requests, and cached by CDN.
Pro & Cons:
2) Post-processing
Steps
avatar
: raw, 144wembed
raw, 1080w, 540w, 360w, 144wprofileCover
: raw, 1080w, 540wResults
# AWS S3 /matters-server-stage ├── 1080w │ ├── uuid.jpeg │ └── uuid.webp ├── 540w │ ├── uuid.jpeg │ └── uuid.webp ├── 360w │ ├── uuid.jpeg │ └── uuid.webp ├── 144w │ ├── uuid.jpeg │ └── uuid.webp └── uuid.jpeg
Usage
[1] We do had set a long cache TTL in CloudFront, but LightHouse doesn't think so.
[2] https://css-tricks.com/responsive-images-css/
[3] https://dev.to/jsco/a-comprehensive-guide-to-responsive-images-picture-srcset-source-etc-4adj
[4] https://css-tricks.com/using-webp-images/#article-header-id-3
The text was updated successfully, but these errors were encountered: