I have a folder in my Google Drive where I put hundreds of my product images.
I want to know if I can write a script that finds the file and then returns the image URL of that file so that it can be viewed from a Google Web App I created?
You can embed image from Google Drive on your web page by url in format https://drive.google.com/uc?export=view&id=DRIVE_FILE_ID
Here is live snippet:
<img src="https://drive.google.com/uc?export=view&id=0ByPNL6sCkWNyWllRVWx2WEFodzA" width="100" height="100">
As noted in the comments to your post, Google has disabled the option of linking directly to a file on Google Drive. However, you can use the Google Drive API to download the file. After which you can encode the image as a base64 encoded string and use it inline by setting the 'src' attribute in an img tag to that encoded string. Granted this is potentially a slow method if your image files are very large, but it should work well for images of moderate size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With