Serving WebP images in lieu of JPEG when applicable
Description
Closes #805
This PR introduces a new feature that converts uploaded images to webp. For every image that is uploaded, a file will be created normally with a .jpeg extension. In addition, a new file with the same name will be created with a .webp extension.
As webp is not supported by all browser versions, we need to provide .jpeg in case of incompatibility. The logic will be handled on the node side. It servers webp or jpeg based on the compatibility check.
##TODO
- Add a function in imageOperations.js that detects webp browser compatibility. More info is found here https://developers.google.com/speed/webp/faq#how_can_i_detect_browser_support_for_webp. We have 2 options: Client side and Server side detection (using headers).
- Write a script that will convert already existing images in Azure Storage to their webp equivalent.
Test plan
Include relevant test configuration details for the reviewer(s), and steps to test and verify new feature.
Before landing
- PR has meaningful title
yarn lintpassesyarn formatpasses
Saving the images as webp works perfectly for me :ok_hand: I think client-side detection makes most sense since the client just needs to add the correct ending to the URL retrieved from the server.
Hey, I was thinking whether we could already merge part of this but I think we first need client-side detection in order to do that, right? Do you need any support on the frontend part?
@FnayouSeif @positiveimpact what is the state of this branch? Anything we can do to move this forward!
@positiveimpact what is the state of this PR? Should close this one and start a new one?