Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

ruby gem for ranking images on an HTML page for use as a thumbnail to represent the page

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 COPYING
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.markdown
Octocat-spinner-32 plumnailer.gemspec
Octocat-spinner-32 test.rb
README.markdown

Compare all of the images on an HTML page and sort them according to how well they represent what the page is about. The top image could be used as a thumbnail to represent the entire page.

Basic usage:

require 'plumnailer'

chooser = Plumnailer::Chooser.new
choice = chooser.choose('http://urls.matthewm.boedicker.org/')
puts choice.source_url

choice.resize_to_fill(64, 64).write('thumb.jpg')

Alternate fetcher that caches images on local filesystem:

require 'plumnailer'

chooser = Plumnailer::Chooser.new
chooser.fetcher = chooser.img_parser.fetcher =
  Plumnailer::CachingFetcher.new('/tmp/plumnailer-test')

choice = chooser.choose('http://urls.matthewm.boedicker.org/')
puts choice.source_url

Top five images:

require 'plumnailer'

chooser = Plumnailer::Chooser.new
chooser.choose('http://urls.matthewm.boedicker.org/', :top => 5).each do |i|
  puts i.source_url
end

Questions and comments: matthewm@boedicker.org

Something went wrong with that request. Please try again.