After my last post, I wanted to write something about IDN and browser support.
So I made lot's of screen shots about how well IDN is supported.
Then I figured that if I ever wanted to do more than one post with images on this blog, I had to host those images somewhere...
So, I started looking at some image hosting services, like google, 500px, ... and in the end, I choose flickr because they have an API, and I already had an account.
In order to avoid uploading images one by one and linking them to my post, I have tried to automate this process using a docpad plugin:

docpad-plugin-flickrimages

This plugin is a fork from docpad-flickr-associatedfiles. It's a start :).
Here is how it works:

  1. List all images in a dedicated folder
  2. Call Flickr to get the list of images with a tag ("docpad" by default, but can be configured)
  3. Get additional properties (url of images in various sizes,...)
  4. If local image is not on flickr, upload it
  5. If local image is on flickr, check the last update, and update the image if necessary
  6. Remove local image from filethat needs to be copied to the output directory
  7. In any page, add a link to an image using document.getFlickrImage('my image.png')
  8. this call will be replace by a reference to the image on flickr
Currently some thing are not yet working:
  • Update an image
  • There are no tests
  • Error cases are not working
  • ...

A little example:

[EDIT: Fev 2017: does not work yet in Hugo]
%- @getDocument().getFlickrImage('blog post code.png') %
%- @getDocument().getFlickrImage('beaglebone.jpg') %

Also: by default, getFlickrImage return a piece of HTML that works fine with fancybox.

Click to view & post Disqus Comments