Skip to content

Instantly share code, notes, and snippets.

@seivan
Created March 25, 2009 23:48
Show Gist options
  • Save seivan/85793 to your computer and use it in GitHub Desktop.
Save seivan/85793 to your computer and use it in GitHub Desktop.
class PhotoPicker # < Liquid::Tag
def initialize(tag_name, photo_pos, tokens)
super
@photo = photo_pos.to_i
end
def render(context)
#photos[@photo].image.url(:medium)
context['post'][@photo].image.url(:medium)
#rand(@photo)
end
end
Liquid::Template.register_tag('picture', PhotoPicker)
end
#index
<%= textilize(Liquid::Template.parse(post.content).render('post' => post.photos)) %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment