This is a single-purpose fork of vanto's simple liquid tag that helps to easily embed images, videos or slides from OEmbed enabled providers, which in turn uses Magnus Holm's great oembed gem which connects to the OEmbed endpoint of the link's provider and retrieves the HTML code to embed the content properly (i.e. an Image tag for Flickr) This fork allows only Flickr embeds, from one particular album (since that's the way I work my blog) but allows a much simpler tag, not requiring you to type out the whole URL every time.
- Make sure you have the
ruby-oembed
gem (Rubygems, Github) installed. - Copy
flickrimg.rb
to<your-jekyll-project>/_plugins
- Add a "flickrimg" config entry to your
_config.yml
, with an 'album' subentry which contains the bit of the flickr URL that identifies your album. In other words, if you have a Flickr URL such ashttps://www.flickr.com/photos/99999999@Z99/8888888888
, put the bit with the nines ("99999999@Z99") in the "album" subentry. - You're done.
Place a flickrimg
tag in your content file. E.g.
<h1>Here's a cool photo!</h1>
{{ flickrimg 8888888888 }}
<h1>Here's the same photo with image size specified</h1>
{{ flickrimg 8888888888 640 480 }}
If you're using Twitter Bootstrap 3 and you'd like all your images to be responsive (i.e., automatically fit themselves nicely on a small screen such as an iPhone), you can use the following jQuery snippet to do this:
$().ready(function() {
$("div.embed img").addClass("img-responsive");
});
Peter Hull -- https://github.com/phoikoi
Tammo van Lessen -- http://www.taval.de
This code snippet is licensed under Apache License 2.0