strapyourself.in and flouri.sh

Mephisto Flickr AJAX Loader

December 1st, 2007

I'm tired of waiting for my blog to load because of a slow flickr feed request! I designed this new plugin by copying the flickr photostream plugin, but making it actually load the pictures and the feed through an immediate AJAX request. This tremendously increased the performance of my mephisto pages!

The plugin defines a flickr controller, which accepts the AJAX request. Unfortunately, you can't change how the photos are laid out anymore (I'm not setting up a liquid context for this ajax response). Of course, if you don't like the result of the plugin, just change it to match what you want:

class FlickrController < ActionController::Base
  def index
    result = ""
    pics = find_pictures
    pics.each do |pic|
      result << "<a href='#{pic.link}'><img src='#{pic.send(params[:format].to_sym)}' alt='#{pic.title}'></a>"
    end

    render :inline => result
  end
end

How to install and use

  • Uninstall the flickr photostream plugin
  • ./script/plugin install http://wush.net/svn/public/plugins/mephisto/mephisto_flickr_ajax
  • Use the following tag in your liquid template:
    {{flickrajaxphotostream feed:<YOUR_FEED_URL> count:<NUMBER_IMAGES> format:<[square, small, etc]>}}
    {{endflickrajaxphotostream}}
  • Originally posted on ELC's blog

Sorry, comments are closed for this article.

original design by gorotron ported by railsgrunt powered by mephisto