public
Description: Ruby wrapper for webthumb.bluga.net
Homepage: http://simplificator.com
Clone URL: git://github.com/simplificator/rwebthumb.git
name age message
file CHANGES Tue Jun 16 06:31:54 -0700 2009 pulled in another fix from rmm5t: job is nil wh... [pascalbetz]
file README Wed Jun 10 13:20:13 -0700 2009 Removed dependency on tzinfo [rmm5t]
file Rakefile Wed Sep 03 02:47:54 -0700 2008 fixed tests for cruise [pascalbetz]
file init.rb Fri Aug 22 03:07:34 -0700 2008 bumped gemspec. changed date of this version [pascalbetz]
directory lib/ Wed Jun 10 17:52:59 -0700 2009 Return a nil job for a webthumb request of an i... [rmm5t]
directory nbproject/ Tue Aug 05 01:00:24 -0700 2008 added easythumb support [pascalbetz]
file rwebthumb.gemspec Tue Jun 16 06:31:54 -0700 2009 pulled in another fix from rmm5t: job is nil wh... [pascalbetz]
directory test/ Wed Jun 10 17:52:59 -0700 2009 Return a nil job for a webthumb request of an i... [rmm5t]
README
== rwebthumb

= what is it
A Ruby wrapper for the webthumb API from http://webthumb.bluga.net and a generator
for the easythumb API

= Installation
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


= Usage
# require the libs
require 'rubygems'
require 'rwebthumb'
include Simplificator::Webthumb

# Creating a Webthumb Object. This is used as your main access point.
wt = Webthumb.new('YOUR API KEY')

# Create a new thumbnail job
job = wt.thumbnail(:url => 'http://simplificator.com')

# fetch the thumbnail. this might throw an exception from server side
# if thumb is not ready yet
job.fetch(:large)

# you can check the status of a job
job.check_status()

# or fetch the thumbnail when it is complete
job.fetch_when_complete(:large)

# once thumbnails are fetched they are cached within the job. so a new fetch will not go to the server again

# there is a helper method to write the images to disk
job.write_file(job.fetch(:custom), '/tmp/test.jpg')

# if you have a job ID then you can use this to get a Job object and then use the fetch_xyz methods
wt.job_status(JOB_ID)

# check the status of your account
wt.status


# generate a Easythumb URL
et = Easythumb.new('YOUR_API_KEY', 'YOUR_USER_ID')
# This returns an URL which you can directly use in your webpage
et.build_url(:url => 'http://simplificator.com', :size => :large, :cache => 1)