After using firebase functions and resizing an image in storage, I have a new image with something like "thum_" attached to the name for the new image.
I'm confused how to replace the original image's download url in database with this resized image so that users would load the resized version. If I don't change the name then I assume my function will be stuck in a loop of resizing because it is "thub_" prefix that prevents the function to go through another time as shown here:
....
//****USING THIS TO MAKE SURE FUNCTION DOESN'T GET INTO A LOOP
if (fileName.startsWith('thumb_')) {
console.log('Already a Thumbnail; exit.');
return;
}
....
I am following this sample.
How can I achieve this?