Reputation: 502
I am using Firebase resize extension successfully to generate thumbnails while deleting the original picture but once the extension is triggered, the original static token is re-newed for the new resized picture. In order to read the thumbnail I need to run a new ref.getDownloadURL()
which I would really like to avoid (extra complication + extra cost). Is there a way to tell the extension (or the underneath function) to keep the old token (metadata) ? Most answers on s.o. seems to refer to older version of the extension or solve a partially similar issue but not this one.
Upvotes: 0
Views: 641
Reputation: 502
I ended up changing the code of the Image Resize Extension function as suggested by Frank van Puffelen:
ext-storage-resize-images-generateResizedImage
and from the 3 dots on the right select Detailed Usage Stats
Upvotes: 1
Reputation: 599946
Since a new file is written by the extension, there is no built-in way to keep the old token. It was an explicit decision to not reuse the existing token, so you might want to read up on that here.
What you can do is to set the old token in the metadata/metadata/firebaseStorageDownloadTokens
property yourself as shown here. The Extension pretty much does the same here, but it always generates a new token. If you want to keep the old token, you will have to do this in code, or modify the extension yourself.
Upvotes: 1