Extensions: Absolute paths restrictions for Storage Resize Image

Created on 19 Aug 2020  路  5Comments  路  Source: firebase/extensions

[READ] Step 1: Are you in the right place?

Issues filed here should be about a feature request for a specific extension in this repository. To file a feature request that affects multiple extensions or the Firebase Extensions platform, please reach out to
Firebase support directly.

[REQUIRED] Step 2: Extension name

This feature request is for extension: storage-resize-images

What feature would you like to see?

It would be great to have the possibility to define a list of absolute paths inside the bucket in which listen for new image uploads to be resized.

The absolute paths to be provided in the configuration option could be a comma-separated list, like this:

/users/avatars,/posts/pictures,/design/resources/icons

This will mean that any image uploaded inside these paths, or inside any folder at any depth inside these will be resized.
And of course, any image outside of these paths will not be resized.

How would you use it?

This will allow us to limit the images to be resized by the extension. For instance, the user's avatars could be resized, but what about if we don't want resized images for posts pictures?

This feature could be very helpful to save much more space in the storage and not waste the resource of Firebase.

in-review feature request

All 5 comments

@yulioaj290 This is exactly the feature I'm looking for in my current project. Hope your pull request goes through! 馃憤

@yulioaj290 thanks for the PR!

@jhuleatt what do you think in terms of costs? Would this actually reduce costs for the users? Also, is this going to be backward compatible?

Having an option to _include_ a list of paths (otherwise all paths would be included if the list is empty) and an option to _exclude_ paths would be very useful. This would give fine grain control.

_Example:_

Include: /images --> this would include /images and all sub-folders
Exclude: /images/do-not-resize --> exclude this specific sub-folder

An even more robust solution would be to allow each _include_ path listed to override the global _size_ setting or have a separate way of handling this. One size doesn't always fit all.

2 concerns:

  1. Even if the extension ignores parts of the bucket when it runs, it will still trigger for everything uploaded to the bucket. So, this change will reduce some cost and unnecessary resizes, but it won't totally get rid of extra cost because of the times it triggers unnecessarily.
  2. We need to make sure this is backwards compatible (if the config is left blank, the whole bucket should still be converted)

I think (1) isn't a blocker, and (2) is something we can take care of in the implementation, so let's go ahead with this.

@wdm954 I think I can add another config option for the Excluded Absolute Paths, in this PR.
The thing related to the size restriction per path is more sophisticated, I vote to do that in a later PR.

Was this page helpful?
0 / 5 - 0 ratings