climateconnect icon indicating copy to clipboard operation
climateconnect copied to clipboard

Serving WebP images in lieu of JPEG when applicable

Open FnayouSeif opened this issue 4 years ago • 4 comments

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

  1. 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).
  2. 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

  1. PR has meaningful title
  2. yarn lint passes
  3. yarn format passes

FnayouSeif avatar Dec 17 '21 13:12 FnayouSeif

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.

positiveimpact avatar Dec 22 '21 14:12 positiveimpact

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?

positiveimpact avatar Jan 20 '22 10:01 positiveimpact

@FnayouSeif @positiveimpact what is the state of this branch? Anything we can do to move this forward!

ddhanesha avatar May 17 '22 05:05 ddhanesha

@positiveimpact what is the state of this PR? Should close this one and start a new one?

ddhanesha avatar Nov 01 '22 05:11 ddhanesha