English

Navigation
Powered by Squarespace
Foobaruy mwe

Buy my book on <a href="lulu.com">lula</a>

« rwebthumb gem updated | Main | git Cheat Sheet »
Donnerstag
Jul102008

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.

Reader Comments (6)

[...] web applications « RubyGem for webthumb [...]

Also make sure you sudo gem install tzinfo.

Alex

August 22, 2008 | Unregistered CommenterAlexander Kellett

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

August 24, 2008 | Unregistered Commenterpascal

On Thursday Oct. 8 around 10AM PDT the bluga service had "queueing issues". As a result our requests tot he service using the ruby webthumb API entered endless loops. This is because the fetch_when_complete method continued in an endless loop as long as it was able to get valid responses from the server (presumably the response that says "still working on it").

The bluga site is fixed and should not have such issues but there is always the chance something else will happen to the service.

I am going to modify/monkey patch Simplificator::Webthumb::Job.fetch_when_complete to take a timeout parameter so that it doesnt check in an endless loop forever.

If you want the modification, can you send me an email with some instructions on where to send the modified code?

Thanks, Mike

Oktober 9, 2009 | Unregistered CommenterMike

wholesale gucci clothing provides you the best and cheapest bags. All the products at http://www.gucci-buying.com are 100% high quality, competitive price, free shipping with best and timely service, 100% satisfaction. Big discount for big order. Welcome to make your choose.

September 2, 2010 | Unregistered Commenterwholesale gucci clothing

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>