Skip to content
Browse files

Fixing README

  • Loading branch information...
1 parent e917a25 commit 4911a7592c0caad260a5c776d4f0c1060a18f5b6 @vicentemundim vicentemundim committed Dec 28, 2010
Showing with 28 additions and 6 deletions.
  1. +28 −6 README.md
View
34 README.md
@@ -25,66 +25,88 @@ Using
Mugshot provides you with a Sinatra application. You can create a **config.ru** file with these contents to start using Mugshot:
+<pre>
# -*- encoding: utf-8 -*-
require "rubygems"
require "mugshot"
run Mugshot::Application.new(:storage => Mugshot::FSStorage.new("/tmp/mugshot"))
+</pre>
Then you can run it with:
+<pre>
$ rackup config.ru
+</pre>
And access in your browser:
+<pre>
http://localhost:9292/myimg/some-name.jpg
+</pre>
This would simply return the image located at /tmp/mugshot/myimg, converting it to a JPEG. Additionaly you can pass some operations to be performed over the image:
+<pre>
http://localhost:9292/resize/100x100/myimg/some-name.jpg # resizing to 100x100 pixels
http://localhost:9292/resize/100x/myimg/some-name.jpg # resizing to 100 pixels in width maintaining aspect ratio
http://localhost:9292/resize/x100/myimg/some-name.jpg # resizing to 100 pixels in height maintaining aspect ratio
http://localhost:9292/crop/200x150/myimg/some-name.jpg # resize and crop image to 200x150
http://localhost:9292/quality/70/crop/200x150/myimg/some-name.jpg # convert it to JPEG with quality of 70% and resize and crop image to 200x150
http://localhost:9292/background/red/crop/200x150/myimg/some-name.jpg # convert it to JPEG with red background and resize and crop image to 200x150
+</pre>
Supported operations
--------------------
### Resize
-/resize/WIDTHxHEIGHT/id/name.jpg (ex: http://mugshot.ws/resize/200x100/myid/thumb.jpg)
+<pre>
+ /resize/WIDTHxHEIGHT/id/name.jpg (ex: http://mugshot.ws/resize/200x100/myid/thumb.jpg)
+</pre>
### Resize keeping aspect ratio
-/resize/WIDTHx/id/name.jpg (ex: http://mugshot.ws/resize/200x/myid/thumb.jpg)
+<pre>
+ /resize/WIDTHx/id/name.jpg (ex: http://mugshot.ws/resize/200x/myid/thumb.jpg)
-/resize/xHEIGHT/id/name.jpg (ex: http://mugshot.ws/resize/x100/myid/thumb.jpg)
+ /resize/xHEIGHT/id/name.jpg (ex: http://mugshot.ws/resize/x100/myid/thumb.jpg)
+</pre>
### Crop
-/crop/WIDTHxHEIGHT/id/name.jpg (ex: http://mugshot.ws/crop/200x100/myid/thumb.jpg)
+<pre>
+ /crop/WIDTHxHEIGHT/id/name.jpg (ex: http://mugshot.ws/crop/200x100/myid/thumb.jpg)
+</pre>
### Quality
-/quality/QUALITY/id/name.jpg (ex: http://mugshot.ws/quality/70/myid/thumb.jpg)
+<pre>
+ /quality/QUALITY/id/name.jpg (ex: http://mugshot.ws/quality/70/myid/thumb.jpg)
+</pre>
### Background
-/background/COLOR/id/name.jpg (ex: http://mugshot.ws/background/red/myid/thumb.jpg)
+<pre>
+ /background/COLOR/id/name.jpg (ex: http://mugshot.ws/background/red/myid/thumb.jpg)
+</pre>
Development
-----------
Clone the repository and run:
+<pre>
$ bundle install
+</pre>
This will install all dependencies for you. Then you can run the specs and features:
+<pre>
$ rake spec
$ rake cucumber
+</pre>
Who's using

0 comments on commit 4911a75

Please sign in to comment.
Something went wrong with that request. Please try again.