Getting alot of images from google drive and displaying in canvas every 10 seconds


#1

Hi, I am trying to add about 1k images from google drive to glitch, possible more later and displaying them after every 10 seconds a new image to the canvas. I was thinking of using gdown to get the folder with all the images but that didnt work as i dont think gdown works with folders. It worked for one image link but since i have many images I need the whole folder instead of getting each image link which would take forever. How exactly can i do this? I am able to display one image by manually uploading it and getting the image url but not sure how to scale this? Another way would be to get a zip file and unzip and upload the images, although that is kind of takes a while as well.


#2

Hi @Neural

The first thing I’d like to caution is that your project’s container has only limited space. Unless your images are very small you’re likely to run out of space in the project while you’re downloading your images. Placing them into the assets drawer doesn’t currently take up space in the container, but that’s likely to change in the future and you shouldn’t count on that being the case.

If you’re not concerned about the space limitations, your best bet is going to be to download and unzip a zip file, which you can do in your project’s console using the wget command and the unzip command.


#3

thanks @cori, yes space would be a issue so i will just limit it to 100 images for now. Also, I figured out a way to just use the google drive images url in the app, so I dont have to move then to glitch, but not sure how to iterate through the whole folder in google drive to fetch all image urls. Possibly in the future to have paid tiers to support more storage? Also, would wget work on google drive folders, as I tried that it didnt work, I get view?usp=sharing after doing wget shared url for zip file. Edit: I got it working using gdown.


#4

Hey @Neural we definitely plan on paid options (possibly including extra space) some time in the future; there are some topics in https://support.glitch.com/c/feature-ideas that might be of interest.

As far as getting the list of files is concerned, https://developers.google.com/drive/api/v2/reference/files/list might be a good place to start.