Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
ruby-thumbor is the client library to thumbor.
Ruby
branch: master

Merge pull request #14 from dlackty/rspec-syntax

Use new default RSpec syntax
latest commit b2cfed1812
@guilhermef guilhermef authored

README.rdoc

ruby-thumbor Build Status Dependency Status Gem Version

DESCRIPTION:

ruby-thumbor is the client to the thumbor imaging service (github.com/thumbor/thumbor).

FEATURES:

  • Generate thumbor encrypted URLs

  • Obtain metadata from image operations in thumbor

DEPENDENCIES

No dependencies required for regular usage.

INSTALL:

gem install ruby-thumbor

gem 'ruby-thumbor'

USAGE:

require 'ruby-thumbor'

crypto = Thumbor::CryptoURL.new 'my-security-key'

url = crypto.generate :width => 200, :height => 300, :image => 'my.server.com/path/to/image.jpg'

# url will contain something like:
# /2913921in321n3k2nj32hjhj3h22/my.server.com/path/to/image.jpg

or

require 'ruby-thumbor'

Thumbor.key = 'my-security-key'
image = Thumbor::Cascade.new('my.server.com/path/to/image.jpg')
image.width(300).height(200).watermark_filter('http://my-server.com/image.png', 30).generate

Available arguments to the generate method:

:meta => bool - flag that indicates that thumbor should return only meta-data on the operations it would
                otherwise perform;

:crop => [<int>, <int>, <int>, <int>] - Coordinates for manual cropping. The first item is the two arguments are
                                        the coordinates for the left, top point and the last two are the coordinates
                                        for the right, bottom point (thus forming the square to crop);

:width => <int> - the width for the thumbnail;

:height => <int> - the height for the thumbnail;

:flip => <bool> - flag that indicates that thumbor should flip horizontally (on the vertical axis) the image;

:flop => <bool> - flag that indicates that thumbor should flip vertically (on the horizontal axis) the image;

:halign => :left, :center or :right - horizontal alignment that thumbor should use for cropping;

:valign => :top, :middle or :bottom - horizontal alignment that thumbor should use for cropping;

:smart => <bool> - flag that indicates that thumbor should use smart cropping;

If you need more info on what each option does, check thumbor's documentation at github.com/thumbor/thumbor/wiki.

CONTRIBUTIONS:

  • Hugo Lopes (hugobr) - Fixes in the usage readme part of the docs.

LICENSE:

(The MIT License)

Copyright © 2011 Bernardo Heynemann <heynemann@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.