def lightbox_group(name, dir)
      images = Dir[File.join(dir, "*.{jpg,JPG,png,PNG,gif,GIF}")].
               sort { |a, b| image_name(a).to_i <=> image_name(b).to_i }

      singles = images.each_with_index.map do |f, i|
        filename = File.join("/", "assets", f.split(File::SEPARATOR)[-3..-1])
        thumbname = File.exists?(thumbs_path f) \
                    ? thumbs_path(filename)
                    : filename

        title = "#{i + 1} of #{images.size}"
        cls = "single" + {0 => " first", images.size - 1 => " last"}[i] || ""

        content_tag(:div, :class => cls) do
          content_tag(:a,
                      :class => "lightbox[#{name.downcase.gsub(" ", "-")}]",
                      href: filename) do
            image_tag thumbname, alt: title, size: "100x100"
          end
        end
      end

      lightbox_set singles
    end
def lightbox_group(name, dir)
      images = Dir[File.join(dir, "*.{jpg,JPG,png,PNG,gif,GIF}")].
               sort { |a, b| image_name(a).to_i <=> image_name(b).to_i }

      singles = images.each_with_index.map do |f, i|
        filename = File.join("/", "assets", f.split(File::SEPARATOR)[-3..-1])
        thumbname = File.exists?(thumbs_path f) \
                    ? thumbs_path(filename)
                    : filename

        title = "#{i + 1} of #{images.size}"
        cls = "single" + {0 => " first", images.size - 1 => " last"}[i] || ""

        content_tag(:div, :class => cls) do
          content_tag(:a,
                      :class => "lightbox[#{name.downcase.gsub(" ", "-")}]",
                      href: filename) do
            image_tag thumbname, alt: title, size: "100x100"
          end
        end
      end

      lightbox_set singles
    end
Takes the photo gallery at +dir+, with the name +name+, and creates a
 Lightbox 2 group from them. Within +dir+ there may be a directory named
 <tt>thumbs</tt> containing the respective thumbnails for each image.