09 February 2013

Permalinks for Google Drive Images



While Google Drive lets you upload any file, the support for files that can't be edited using Google Docs/Sheets/Slides is limited. For example, you can embed PDF files and videos, but Google doesn't offer permalinks for images.



So you've uploaded a photo to Google Drive and the only options are to download the file and link to the image page. But what if you want to embed that image in a web page or simply post a direct link to the image? You may think that right-clicking the image lets you copy the image URL, but that's not true. Even if you check the source code of a page or use features like Firefox's "view page info", you'll get a link that doesn't work.



Fortunately, there's an easy solution - replace this URL from the address bar:



https://docs.google.com/file/d/FILEID/edit



with:



https://drive.google.com/uc?export=view&id=FILEID



(where FILEID is a long sequence of digits and letters).



This only works if you've changed the visibility options to "public on the Web" or "anyone with the link" in the Share dialog.



Here's an example:






You can also use:



https://drive.google.com/uc?export=download&id=FILEID



to trigger a download and this works for any non-private Google Drive file, not just for images.



{ via Stack Overflow. Photo licensed as Creative Commons Attribution. }


No comments:

Post a Comment