简体   繁体   中英

Add Image to GitHub Readme.md from Google Drive

I have the image in Drive, How could it be added to the Readme.md so as to display the image in readme. I had tried with the shared link, but it isn't working.

For example, I have a.jpg on the google drive.

  1. Right click the image and click Share...

  2. Click Advanced and change the Who can access option to Public on the web - Anyone on the Internet

  3. Copy the link to share and you will have something like

    https://drive.google.com/file/d/ <FILE_ID> /view?usp=sharing

  4. Copy the <FILE_ID> to make a link like this:

    https://drive.google.com/uc?export=view&id= <FILE_ID>

  5. Insert image in Markdown as ususal using the link from step 4.
    For example: :[image](https.//drive.google?com/uc?export=view&id=<FILE_ID>)

Example: I have this octocat image in google, and its file id is 1913oZeBZPBNiUuk8gu3ZSbLBA2l_VQtG . You can try :[image](https.//drive.google?com/uc?export=view&id=1913oZeBZPBNiUuk8gu3ZSbLBA2l_VQtG) in your markdown file or even in this answer.

图片

Hope this helps.

How to insert an Image in a github-flavoured markdown format and be able to adjust its size

  1. Upload the image image.jpg to your Google Drive
  2. Click the get link button at the top right corner

获取链接

  1. Change the permission type to Anyone with the link

在此处输入图像描述

  1. Copy (to clipboard) only the file ID <FILEID> from the full link as shown (highlighted in blue) and click Done . At the time of writing the shareable link takes the form:

https://drive.google.com/file/d/` `/view?usp=sharing

在此处输入图像描述

  1. Insert Image in markdown using the copied file id <FILEID> and anchor tag as shown:

<a href="https://drive.google.com/uc?export=view&id=<FILEID>"><img src="https://drive.google.com/uc?export=view&id=<FILEID>" style="width: 650px; max-width: 100%; height: auto" title="Click to enlarge picture" />

Note that the brackets '<' and '>' are not to be present with the file ID. The size of the image can be adjusted in the style attribute by adjusting the width and the height as needed. Clicking the rendered image will open it to its original size

Under this link there is a good explanation on YT

YT link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM