5

I want put external image on my blog created with Pelican

So i try:

some text

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

After running "pelican -s pelicanconf.py" I've got error:

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'

And no image in my post.

Questions is: How put external images in my blog.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
kendriu
  • 565
  • 3
  • 21
  • Why the leading http:// in http://image.png? – usr1234567 Feb 24 '15 at 21:42
  • because image is not under my domain. It's external resource. I'm writing post about this tool https://github.com/karan/joe and i wan't put which will be linking to theirs image. So in this case It will be something like this: – kendriu Feb 24 '15 at 21:45
  • Obviously Pelican is expecting a relative path. You give an absolute one. Maybe this is configurable. – usr1234567 Feb 25 '15 at 06:56
  • Didn't found it in configuration – kendriu Feb 25 '15 at 18:25
  • 1
    Pelican definitely lets you do that, however the error is coming from a plugin (note the `Better Fig. Error` part). I suggest you file an issue in the plugins repo. – Avaris Mar 09 '15 at 15:08
  • 1
    @Avaris you are right. Error was in Better Fig. plugin, not in pelican. – kendriu Apr 17 '15 at 08:32

1 Answers1

0

Pelican expects paths to be within the content directory. In general, this is a good idea because it is not kind to pull content and use other people's bandwidth.

You will have to do this using the raw tag like so:

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

The best solution is to download the image (assuming you have permission) and then include it in your content folder and then host it yourself, a la default behaviour.

update

For hosting images from google drive see this discussion: Displaying files (e.g. images) stored in Google Drive on a website

The solution by Mori works for me:

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

Which translates into this in the above example:

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

Works like a charm using the Google Drive API.

Community
  • 1
  • 1
Adam Tindale
  • 1,239
  • 10
  • 26
  • It's not so simple. I was going to to serve my images from google drive. In pelican i wanted just have links to those images on google drive. So, as you see it has nothing to do, with being kind or unkind. Not to mention, that one could want to put images on SDN servers. What then? – kendriu Feb 25 '15 at 21:08