Reputation: 519
I'm making simple project which uploads files on Google Drive. Then i need to "show" this files to users, by using html < img > tag for this i need to know URL to my image. But i don't know how to get it. I've tried to add
to my Google Drive File's id, but it hadn't worked although i can see the image in my browser by using this method, also i checked code of this page and found this
As you may see, i found my image, but my fileid isn't similar to id underlined at the photo.
Upvotes: 2
Views: 3947
Reputation: 765
There are a lot of methods as posted in SO 10311092, some of which are already deprecated. However, there seems to be one that still works as of October 2018. This answer by ctf0 is very simple.
here is how from @ https://productforums.google.com/forum/#!topic/drive/yU_yF9SI_z0/discussion
1- upload ur image
2- right click and chose "get sharable link"
3- copy the link which should look like
https://drive.google.com/open?id=xxxxxxx
4-change the open? to uc? and use it like
<img src="https://drive.google.com/uc?id=xxxxx">
- its recommended to remove the http: or https: when referencing anything from the web to avoid any issues with ur server.
Or you can also try Google's method: providing users direct access to a file via the URL in the webViewLink
property.
Upvotes: 3