Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Image resizing HTTP service

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 config
Octocat-spinner-32 lib
Octocat-spinner-32 public
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 EXTRAS.md
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 config.ru
Octocat-spinner-32 resizer_service.gemspec
README.md

Image resizer service

A small image resizing proxy app

Requirements

  • ImageMagick

    • OSX/Homebrew: brew install imagemagick
    • Ubuntu: sudo apt-get install imagemagick
  • Ruby 1.8+

    • OSX: You already have it
    • Ubuntu: sudo apt-get install ruby19
  • Some Ruby gems

    • (The app will alert you when you have missing Ruby gems.)

Usage

Start me like you would any Rack app.

$ rackup

Now request for an image this way:

http://localhost:3000/image?resize=200x200&source=http://example.org/image.png

..and the resizer service will grab your image and resize it for you.

Available parameters

These parameters have to be passed onto /image as GET parameters.

  • source
    (Required) The URL of the image to process.

  • resize
    (Required) Resizes the image in WIDTHxHEIGHT format. Both width and height are optional, but at least one has to be defined. Examples:

    • 500x200
    • 500x
    • x40

Optional parameters

  • format
    The image format you need it in. Can be any of the following:

    • png
    • jpg
    • gif
  • quality
    The JPEG quality level (defaults to 80). Has to be a number between 0 and 100.

  • rotate
    (Integer) The number of degrees to rotate the image in.

  • vflip
    When set to 1, flips the image vertically.

  • hflip
    When set to 1, flips the image horizontally.

Examples

This resizes to 200px width as a JPEG with 30% quality.

http://localhost:3000/image?resize=200x&source=http://example.org/image.png&format=jpg&quality=30

Acknowledgements

Inspired by http://boxresizer.com/, which this is (mostly) compatible with.

Something went wrong with that request. Please try again.