Reputation: 27
Now that Google is deprecating hosting Drive files with the interface
googledrive.com/host/[doc id] as of Aug. 31, 2016, how can I access Drive photos directly while still keeping my HtmlService code. The code I am currently using is:<img src="'+obj.imageUrl+'" height="'+pheight+'" width="100%">
Where obj.imageUrl is using a url based upon the deprecated googledrive.com/host/[doc id]?
Upvotes: 1
Views: 250
Reputation: 2053
For small scale projects it's possible to the url https://drive.google.com/uc?id=XXX
where XXX
is the file id on Google Drive. This can be hard coded or found using DriveApp
e.g. DriveApp.getFilesByName(IMG_FILE).next().getId();
Googler, Eric Koldea, has however warned that this technique doesn't scale (see comments thread):
I'd caution against using this for anything popular, since I believe the quotas for serving content this way aren't very high. You may be able to use this as a hack for small projects, but you're better off going with a real solution like Google Cloud Storage or Firebase Hosting.
Upvotes: 1
Reputation: 8082
From Apps Updates - Deprecating web hosting support in Google Drive, the best option that was given is to find a new website host with Google Domains. As stated in the blog:
For those who have used Drive to host websites, Google Domains can refer you to third parties for website hosting functionality. For those who use this feature to serve non-user content to web and mobile applications, Google Cloud Platform offers a solution for this purpose.
Upvotes: 0