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

Pelican external image in restructured text

我想把外部图片放在我用 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'

我的 post 中没有图像。

问题是:如何把外部图片放到我的博客中。

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

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

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

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

更新

要托管来自 google 驱动器的图像,请参阅此讨论: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 驱动器 API 非常有效。