Skip to main content

Google Drive - Generate Image Direct URL

Updated over 6 months ago

Generate Direct Image Link with Google Drive

Procedures

  1. Upload your image into your Google Drive if you don’t already have something there you plan to use. You can also drag and drop your image file into the desired location

  2. Right-click the image and select Share

This image displays the a drop down menu of "Pictures" which shows an image saved as "Tiger.jpg", with the context menu below and "share" is highlighted.

Set the Permissions and Copy the URL

  1. In the dialog box, select Get Link

  2. Ensure the permissions are set to Anyone with the link can view

  3. Permission level should be Viewer

  4. Click Copy Link, then click Done

    This image displays the dialog box "Get link" with the link highlighted and 5 steps on how to access and copy the link.
  5. Paste this link into notepad or another text editor

  6. Copy the ID from the URL. In this example, the ID that was generated was 1ROFMLHNLdNbmORhLVwv5ecfAswpRokkI

Example: https://drive.google.com/file/d/1ROFMLHNLdNbmORhLVwv5ecfAswpRokkI/view?usp=sharing

Hang onto this for the time being.

The “Base” Code for Direct Image Link from Google

Copy/Paste the following into notepad or other text editor:

Create the Custom URL by using elements from each

Swap the *img_id* with your image ID.

The final product from this example would look like this example:

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

Use your final product (link) for displaying images directly into a Moodle page.

For example, this image was inserted into a Moodle course page by clicking the Insert an image icon and entering the custom URL.

You can also adjust the size and alignment, as shown in this screenshot.

This image shows the Image Properties window which displays the URL, a text box for alternative text, the size, and alignment for the image shown below.
Did this answer your question?