require 'image_size' def image(name, title="", link=nil) # all images are stored at content/pigs and only the main site routes them ret = "" # read image size img = ImageSize.new IO.read("content/pigs/#{name}") # if it's too large, redirect to smaller version (which is generated with 'nanoc images') if img.width > 400 and not name.end_with? ".gif" link = "/pigs/#{name}" if link.nil? # link to big version name.gsub! /^(.+)\.(\w+)$/, '\1_small.\2' img = ImageSize.new IO.read("content/pigs/#{name}") # re-read image end ret += "" unless link.nil? ret += "#{title}" ret += "" unless link.nil? ret end def youtube(url) < EOL end def dailymotion(url) < EOL end def google_video(url) < EOL end def vimeo(url) < EOL end