firebase/extensions

[storage-resize-images] The resize function is called twice for each uploaded image

開放

#932 建立於 2022年3月31日

 (3 則留言) (1 個反應) (0 位負責人)TypeScript (431 個分叉)github user discovery
extension: storage-resize-imagesgood first issuepending-interesttype: feature request

倉庫指標

星標
 (976 顆星)
PR 合併指標
 (平均合併 7天 11小時) (30 天內合併 3 個 PR)

描述

[REQUIRED] Step 2: Describe your configuration

  • Extension name: storage-resize-images
  • Extension version: 0.1.26

[REQUIRED] Step 3: Describe the problem

The resize function is called twice for each uploaded image.

Steps to reproduce:

  1. Install the extension with any configuration
  2. Upload an image to the storage
  3. The function will be triggered and it will resize the image and save it back to the storage successfully.
  4. The function will be triggered again (this time for the newly added resized image).
  5. The function will log File is already a resized image, no processing is required and will stop executing.

While this works totally and there are no errors or crashes, this causes a lot of unnecessary function calls. Imagine that I configure the extension to resize each image to multiple sizes (e.g. 200x200, 400x400, 800x800). This will cause 4 function calls for each image and 3 of them are unnecessary.

I suggest adding the ability to set different buckets for source and destination. That way I can create a separate bucket named images-to-resize for example, and the resized images will be stored in the other specified bucket.

Expected result

To trigger the resize function once for each image.

Actual result

The resize function is called multiple times for each image.

貢獻者指南