如何从 Google Drive 在 Google Colaboratory 中插入内嵌图像 [英] How to insert an inline image in Google Colaboratory from Google Drive
问题描述
我正在尝试使用此表达式 ![Text](https://xxxx)
在已保存在 Google Drive 中的 Google Colaboratory (markdown) 中插入图像,但它不起作用.例如,Colaboratory markdown 手册展示了如何在此示例中插入内嵌照片 内嵌图片:![Google 的徽标](https://www.google.com/images/logos/google_logo_41.png)代码>.好的,这是一张来自互联网的照片,但是,当我将该照片替换为已保存在我的 Google 云端硬盘中的照片时,它不会出现.
I am trying to insert an image in Google Colaboratory (markdown) already saved in Google Drive using this expression ![Text](https://xxxx)
but it doesn't work. For example, the Colaboratory markdown manual shows how to insert a photo inline with this example An inline image: ![Google's logo](https://www.google.com/images/logos/google_logo_41.png)
. Ok, that is a photo from internet, but, when I replace that photo for one already saved in my Google Drive it doesn't appear.
推荐答案
如果你有这样的链接,那么我有一个解决方案.
If you have a link like this, then I've got a solution.
https://drive.google.com/file/d/-------/view?usp=sharing
- 在 Google 云端硬盘中,右键单击图片
选择获取共享链接"
- In Google Drive, right-click on the picture
Choose 'Get a sharable link'
点击复制链接".您需要读者权限.只需要图片的id即可.
Click to 'Copy link'. You need reader permissions. Just need the id of the image.
就我而言,我的链接是:
In my case my link is:
https://drive.google.com/file/d/1xDrydbSbijvK2JBftUz-5ovagN2B_RWH/view?usp=sharing
现在我们需要复制JUST图像ID:
Now we need to copy JUST the image id:
1xDrydbSbijvK2JBftUz-5ovagN2B_RWH
我们将使用这个基础链接来生成带有图片ID的链接:
We will use this base link to generate your link with the image id:
https://drive.google.com/uc?export=view&id=your_id
然后我们复制链接中的id:
We then copy the id in the link:
https://drive.google.com/uc?export=view&id=1xDrydbSbijvK2JBftUz-5ovagN2B_RWH
最后,在 Google Colab 中放置图片:
Finally, to place as an image in Google Colab:
![](https://drive.google.com/uc?export=view&id=1xDrydbSbijvK2JBftUz-5ovagN2B_RWH)
这篇关于如何从 Google Drive 在 Google Colaboratory 中插入内嵌图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!