gpt4 book ai didi

python - 重构文本中的鹈鹕外部图像

转载 作者:太空狗 更新时间:2023-10-30 01:38:00 24 4
gpt4 key购买 nike

我想把外部图片放在我用 Pelican 创建的博客上

所以我尝试:

some text

.. image:: http://example.com/image.png
:alt: Alt text

运行“pelican -s pelicanconf.py”后出现错误:

ERROR: Better Fig. Error: image not found: /Users/kendriu/sources/pelican-blog/contenthttp:/example.com/image.png
ERROR: Could not process ./4_joe.rst
| [Errno 2] No such file or directory: u'/Users/kendriu/sources/pelican-blog/contenthttp:/example.com/image.png'

我的帖子里没有图片。

问题是:如何将外部图片放入我的博客。

最佳答案

Pelican 期望路径位于内容目录中。总的来说,这是一个好主意,因为拉取内容并使用其他人的带宽是不友善的。

您必须像这样使用原始标签来执行此操作:

.. raw:: html 
<img src="http://example.com/image.jpg" alt="alt text">

最好的解决方案是下载图像(假设您有权限),然后将其包含在您的内容文件夹中,然后自行托管,这是一种默认行为。

更新

要托管来自谷歌驱动器的图像,请参阅此讨论:Displaying files (e.g. images) stored in Google Drive on a website

Mori 的解决方案对我有用:

https://drive.google.com/uc?id=FILE-ID

在上面的例子中转化为:

.. raw:: html 
<img src="https://drive.google.com/uc?id=0B9o1MNFt5ld1N3k1cm9tVnZxQjg">

使用 Google Drive API 的效果非常好。

关于python - 重构文本中的鹈鹕外部图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28706806/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com