将图像从 Google 驱动器添加到 GitHub Readme.md

Add Image to GitHub Readme.md from Google Drive

我在驱动器中有图像,如何将它添加到 Readme.md 以便在自述文件中显示图像。 我曾尝试使用共享 link,但它不起作用。

例如,我在 google 驱动器上有 a.jpg

  1. 右击图片然后点击Share...

  2. 单击 Advanced 并将 Who can access 选项更改为 Public on the web - Anyone on the Internet

  3. 复制 link to share 你会得到类似的东西

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

  4. 复制 以制作 link,如下所示:

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

  5. 像往常一样使用步骤 4 中的 link 在 Markdown 中插入图像。
    例如: ![image](https://drive.google.com/uc?export=view&id=<FILE_ID>)

示例:我在 google 中有这个 octocat 图像,它的文件 ID 是 1913oZeBZPBNiUuk8gu3ZSbLBA2l_VQtG。您可以在降价文件中甚至在这个答案中尝试 ![image](https://drive.google.com/uc?export=view&id=1913oZeBZPBNiUuk8gu3ZSbLBA2l_VQtG)

希望对您有所帮助。

如何以 github-flavoured 降价格式插入图像并能够调整其大小

  1. 将图像 image.jpg 上传到您的 Google 驱动器
  2. 点击右上角的get link按钮

  1. 将权限类型更改为Anyone with the link

  1. 仅复制(到剪贴板)来自完整 link 的文件 ID <FILEID>,如图(以蓝色突出显示),然后单击 Done。在撰写本文时,可共享 link 采用以下形式:

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

  1. 使用复制的文件 ID <FILEID> 和锚标记在 markdown 中插入图像,如下所示:

<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" />

请注意,括号“<”和“>”不能与文件 ID 一起出现。 图片的大小可以在style属性中根据需要调整width和height。单击渲染图像会将其打开为原始大小