Gmail Attachments – Inline Image from Google Drive

gmailgoogle-drive

Is there a way to attach my images directly from my Google Drive inline when composing a message on Gmail?

When I try to attach an inline image from a shareable link on my Google Drive, it doesn't show inline when attached, but an image is visible on the preview of image when using the Add Photo > Web URL functionality of Gmail.

Getting Shareable Link from Google Drive

Getting Shareable Link from Google Drive

Using Insert Photo from Gmail

Using Insert Photo from Gmail

Photo is Not Properly Attached

Icon not inline image

The reason why we need to use the photo from Google Drive is that we need the versioning of the file, and when we update the image, all the emails that have been sent with the image should be updated as well. We use it for our company wide announcements and resending an updated image would just spam everyone.

Is there a way for this to be possible?

Best Answer

Short answer

Use url in format

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

Explanation

You cannot use url that Google Drive provides as "share link":

  • https://drive.google.com/open?id=DRIVE_FILE_ID
  • https://drive.google.com/file/d/DRIVE_FILE_ID/view?usp=sharing

as image src, because it's actually link to a web page (MIME type text/html).

Instead https://drive.google.com/uc?export=view&id=DRIVE_FILE_ID will return document with needed MIME type image/* which you can use as image source.

References:

  1. view Images that are uploaded to Google Drive - Stack Overflow
  2. MIME types