While creating assignment descriptions using CodeHS Create, sometimes you may want to insert an image from your Google Drive. Since 'Sharing' an image from Google Drive does not actually provide a direct link, there are a few more steps involved in finding a direct link that you can embed using Markdown:
Find the Image ID, and
Insert the image ID into an embed link
Finding Image ID
To find the ID of an image file:
Navigate to the file on your Drive
Click the eye icon to Preview
Click the three dots … and click Open in New Window:
In this new window's URL, the string of text after
drive.google.com/file/d/
is the ID of the image file.
For example, in the following URL:
https://drive.google.com/file/d/1CUxrGQCLycjWMAcU3KT4sOhSdIFi4tUW/view
This is the ID:
1CUxrGQCLycjWMAcU3KT4sOhSdIFi4tUW
Insert into Embed Link
Now that you have the image file ID, you can create a direct link to the image that can be used in Markdown or HTML.
To create a Direct Link, start with this URL:
https://drive.google.com/uc?export=view&id=<FILE_ID>
Using the above image ID example, the final URL would look like:
https://drive.google.com/uc?export=view&id=1CUxrGQCLycjWMAcU3KT4sOhSdIFi4tUW
This is a direct link that you can use in HTML or Markdown.
Still have questions? Contact our team at hello@codehs.com to learn more!