RubyGem for webthumb
Webthumb is a service to create thumbnails from websites (descriptive name, isn’t it…). It creates different sized thumbnails by default and you can request custom sizes.It offers an API to access it’s services and we wrapped up some code i wrote while on vacation and bundled it as a gem.The code is still a bit clumsy (as i wrote it on vacation :-) ) but it works nice for us. There is already another ruby wrapper for the API but it is not available as a RubyGem and does not expose some of the latest webthumb functionalities so we decided to write our own library. Josh gave us some extra credits so we could develop the API. Thanks. The gem is available on Simplificator’s github repo. To install do following:
sudo gem update --system (in case you are not yet on version 1.2.0 or higher)
sudo gem sources -a http://gems.github.com (only once)
sudo gem install simplificator-rwebthumb
To create thumbnails:
require 'rubygems'
require ‘rwebthumb’
include Simplificator::Webthumb
# main access point for the Webthumb API
wt = Webthumb.new(’YOUR API KEY HERE’)
job = wt.thumbnail(:url => ‘http://simplificator.com’)
job.write_file(job.fetch_when_complete(:large), ‘/tmp/test.jpg’)
For more info check the README file and (currently) the source code. All the features from a the request element are supported but currently not documented. I’ll look into that in some days.If you want to use the Gem you’ll need an account for webthumb. You’ll get 100 free credits every month so it’s easy to try it out.
back
July 11th, 2008 at 14:09
[…] web applications « RubyGem for webthumb […]
August 22nd, 2008 at 14:16
Also make sure you sudo gem install tzinfo.
Alex
August 24th, 2008 at 9:44
Hey Alex
tzinfo is mentioned as dependency. It is used to convert from MST to UTC time.
I added it in installation section to make sure everything is working..
Pascal