Create custom loop to download multiple images
Hello Koders, Nikhil here,
And yestrerday i got a post in which a koder is trying to download multiple image from firebase but he was using wrong blocks.
Because of that post’s title I thought to create new post of guide with relevant title so that it will help may koders.In this post i have downloaded 5 images.
So guy its my first guide post.
And i’ll try to explain everything carefully.
What we need
- We have created custom loop.
- Spreadsheet(because i’m getting data from it)
- Download extension
- Label - to check whether all file downloaded or not.
- Dynamic image - to create image and setting it.It is not necessary . you use use image component or use downloaded image as background images.
Blocks Image
Blocks Explanation
So first of all i have created 2 variables and 1 procedure -
- imglist - to store image link list.
- DownloadingIndex - to check number of file downloaded and used in custom loop which is assigned to 1.
- downloader - name of procedure to check whether number of file download is less than or greater than length of list of image.
Now, when screen initialize I am getting list of link of images from Airtable.
When we got column i am storing it to imglist whose length is 5.
Now we are calling procedure downloader. And in downloader we firstly check DownloadingIndex values is less than or equal to length for imglist or not.
And then i’m renaming file which is going to be downloaded(Renaming file is not necesssary). And then calls starts download.
Now When Download Complete, I’m creating image with dynamic image and setting downloaded image to created dynamic image.
And then increasing value of DownloadingIndex by 1.After increment I call procedure downloader again.
Now this time in Downloader procedure value of DownloadingIndex,File name,Downloading url changes. and in the end when downloadingIndex i greater than length of imglist then we set label text to All image downloaded perfectly
Conclusion
In last 2 steps you can observe that we are calling downloader procedure many time.Therefore we have creater custom loop to download multiple images.
Result
i am not the owner of the image shown in above screenshot
I hope i have tried my best to explain everything.And i have attached aia and apk below.
apk file - Download_Multiple_Image.apk (4.8 MB)
aia file - will be uploaded soon.
Is this post useful to you?
- YES
- NO
0 voters