Many of us will at some point want to create images that are different sizes, for instance, a thumbnail, so the app runs quickly. Fortunately, that is very easy as there is a no-code cloud function that you can install which you find under Extensions in Firebase.
[image.png]It listens to new images being saved to the storage bucket and creates a new version in a subfolder and adds an extension, for instance, 100x100.jpg to tell us that the image is 100x100 pixels in size. Therefore the function is not triggered by an API, but by saving the file to the bucket, all automated. Here is the problem, the function fires usually within 1000 ms, but sometimes it takes longer. When it takes longer my app looks for the thumbnail, does not find it because it has not been generated yet, and returns a blank box. In theory, I could make the wait time so long as to capture the slowest triggers, but that is poor coding. Better is to fill the thumbnail at first with the URL of the large image, and when the thumb is ready, swap that out for the thumb. I have 90% of the solution I think which is this action. I borrowed the idea from the AI Image Marketplace app and had not seen the technique before but it looks like this.
[image.png] So the periodic timer keeps looping until it finds what it is looking for. The problem is I have yet to find a way to test whether the thumb has been generated yet. Therefore I am looking for a boolean custom action to go to Firebase Storage and see if the thumb is there yet. The action or function has been eluding me for months. The timer is set to 1000ms loops so in theory if it took three seconds it would loop three times, and then the action would follow the left-hand path and complete. Anyone written an action that tests for an empty field in Firebase? In the above screenshot that would be the "thumbURL is set" action. I tried to generate it with AI, but it wants to test for a null value, which is not allowed any longer. [image.png] When I get the answer I will put the full solution in a post, including all my other actions and functions that get this far, but without this last piece of the jigsaw, it does not work.