søndag den 18. februar 2018

Setting Up Flickr Galleries in Octopress

During the last few years, I’ve picked up photography as one of my pastime activities.
Up until recently, I was using Jekyll with a gallery gem to manage my galleries online, for my family and friends.
However, as flickr recently changed their service, by upgrading all users to 1Tb free space, as well as improving the design and functionality a lot, I decided to move all of my public galleries to flickr.

Why use flickr instead of pure jekyll/octopress?

There are some clear advantages to hosting the imagery yourself, including full control over all images, and not having to bother with flickr’s API’s.
However, I saw these advantages:
  1. flickr provides an excellent categorizing tool, allowing for collections/sets, tagging etc.
  2. You don’t need a seperate copy of the images locally, just for octopress. In my case, I shoot exclusively in RAW, and generate 3000x2000 px. images for web. That quickly takes up space
  3. flickr is probably better / faster at serving images than my own server.
  4. Yet another (free) off-site backup option is sweet.

There are other jekyll/octopress plugins out there

Mugge did a great Octopress implementation for simplifying flickr integration into Octopress, available here: https://github.com/neilk/octopress-flickr. This allows you to insert a single Liquid tag on a jekyll/octopress page, and it will show a set or a photo based on the properties you set.
However, as I wanted more control over how the implementation is handled, I started out by forking his repo, and eventually ended up creating somewhat of a hybrid between Neil’s idea and a page generator.

The main challenge

The main reason for creating my own jekyll/octopress Generator is, as mentioned previously, that I wanted more control over the HTML generated for a set.
Also, I wanted to generate a complete gallery, containing all my flickr sets in one single inde page, instead of having to set up single pages myself, containing the sets individually.
Previously I used jekyll https://github.com/ggreer/jekyll-gallery-generator, which does this, so I basically wanted the same approach, only using the images through flickr’s API instead of having them locally.
My approach consists of the following setup:
  • A template file for an index of all sets / galleries for a given user
  • A template file for the actual set you’re browsing
  • A few helper functions, based on Neil’s work and the excellent flickraw gem for handling interaction with the API
  • The generator plugin itself

Introducing octopress-flickr-generator

I’ve just pushed the octopress-flickr-generator project to GitHub, so I’m not going to go into specifics about the generator, however it does the following:
  • Allows for generating an index of all, public sets of a flickr user
  • Creates a “gallery” page for each set, using simple Liquid templates, which allows for logic
  • It applies a specific sorting method, allowing for grouping of sets in collections.
Anyway, you can read more about it at the official GitHub repo
You can see a demo of it running here at our own photo site
Yes, that’s me jumping around in a suit. Yes, I drank alcohol. No, you probably don’t understand the labels in danish. Yes, my language has funny letters.

Fotograferings-bureau

fotograf fotograf uddannelse fotograf københavn fotograf odense fotograf aalborg fotograf århus fotograf kolding fotograf vejle fotograf h...