banner

Flickr2reStructuredTextΒΆ

On the Images markup examples page I explain how to use the reStructuredText image directive to include images hosted on a remote server. Flickr2rst automatically generates the markup for images hosted at Flickr. The script takes a Flickr photo-id as an argument. If no argument is given a default photo-id is used. See http://www.flickr.com/services/api/misc.urls.html for information about the Flickr photo-id.

Usage: <flickr2rst.py> [options] [arg]

Options:
-h, --help show this help message and exit
-s size [square, thumbnail, small (default), medium, large, orginal]
-a align [left, right (default), middle]

Example. Running python flickr2rst.py -a left -s small 2419641800 prints the following to stdout:

.. image:: http://farm3.static.flickr.com/2360/2419641800_ef0169e51d_m.jpg
       :height: 160px
       :width: 240px
       :alt: The flag of Milan
       :align: left
       :target: http://www.flickr.com/photos/jeroenleijen/2419641800/

When I edit a reStructuredText text I run the script from inside vim like this: :r! python /path_to/flickr2rst.py [photo-id].

Flickr2rst is python script. It uses the flickrapi module. You can get it from http://stuvel.eu/flickrapi.

Download flickr2rst.py: click here. Flickr2rst is released under the MIT X licence. Please read my software notice.


Published:Mon Dec 20 2010