mugshot 0.4.2 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +105 -12
- data/features/support/env.rb +1 -1
- data/lib/mugshot/application.rb +56 -7
- data/lib/mugshot/fs_storage.rb +1 -1
- data/lib/mugshot/version.rb +3 -0
- data/spec/mugshot/application_spec.rb +194 -6
- data/spec/mugshot/image_spec.rb +1 -1
- metadata +93 -38
data/README.md
CHANGED
@@ -7,36 +7,129 @@ Mugshot
|
|
7
7
|
Overview
|
8
8
|
--------
|
9
9
|
|
10
|
-
The basic idea of Mugshot is that you upload the largest/highest quality images
|
11
|
-
possible. When retrieving the images you apply different operations to it such
|
12
|
-
as: resizing, rounded corners, transparency and anything else we can think of!
|
10
|
+
The basic idea of Mugshot is that you upload the largest/highest quality images possible. When retrieving the images you apply different operations to it such as: resizing, rounded corners, transparency and anything else we can think of!
|
13
11
|
|
14
|
-
Only the original image is stored on the server. All operations are performed
|
15
|
-
dynamically, which is why caching is so important (see below).
|
12
|
+
Only the original image is stored on the server. All operations are performed dynamically, which is why caching is so important (see below).
|
16
13
|
|
17
14
|
|
18
15
|
Caching
|
19
16
|
-------
|
20
17
|
|
21
|
-
Mugshot doesn't cache anything by itself but is designed to play nice with
|
22
|
-
standard HTTP caching.
|
18
|
+
Mugshot doesn't cache anything by itself but is designed to play nice with standard HTTP caching.
|
23
19
|
|
24
|
-
For production use, don't even think about using Mugshot without something like
|
25
|
-
Varnish or Squid sitting in front.
|
20
|
+
For production use, don't even think about using Mugshot without something like Varnish or Squid sitting in front.
|
26
21
|
|
27
22
|
|
23
|
+
Using
|
24
|
+
-----
|
25
|
+
|
26
|
+
Mugshot provides you with a Sinatra application. You can create a **config.ru** file with these contents to start using Mugshot:
|
27
|
+
|
28
|
+
<pre>
|
29
|
+
# -*- encoding: utf-8 -*-
|
30
|
+
require "rubygems"
|
31
|
+
require "mugshot"
|
32
|
+
|
33
|
+
run Mugshot::Application.new(:storage => Mugshot::FSStorage.new("/tmp/mugshot"))
|
34
|
+
</pre>
|
35
|
+
|
36
|
+
Then you can run it with:
|
37
|
+
|
38
|
+
<pre>
|
39
|
+
$ rackup config.ru
|
40
|
+
</pre>
|
41
|
+
|
42
|
+
And access in your browser:
|
43
|
+
|
44
|
+
<pre>
|
45
|
+
http://localhost:9292/myimg/some-name.jpg
|
46
|
+
</pre>
|
47
|
+
|
48
|
+
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:
|
49
|
+
|
50
|
+
<pre>
|
51
|
+
http://localhost:9292/resize/100x100/myimg/some-name.jpg # resizing to 100x100 pixels
|
52
|
+
http://localhost:9292/resize/100x/myimg/some-name.jpg # resizing to 100 pixels in width maintaining aspect ratio
|
53
|
+
http://localhost:9292/resize/x100/myimg/some-name.jpg # resizing to 100 pixels in height maintaining aspect ratio
|
54
|
+
http://localhost:9292/crop/200x150/myimg/some-name.jpg # resize and crop image to 200x150
|
55
|
+
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
|
56
|
+
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
|
57
|
+
</pre>
|
58
|
+
|
28
59
|
Supported operations
|
29
60
|
--------------------
|
30
61
|
|
31
62
|
### Resize
|
32
63
|
|
33
|
-
|
64
|
+
<pre>
|
65
|
+
/resize/WIDTHxHEIGHT/id/name.jpg (ex: http://mugshot.ws/resize/200x100/myid/thumb.jpg)
|
66
|
+
</pre>
|
34
67
|
|
35
68
|
### Resize keeping aspect ratio
|
36
69
|
|
37
|
-
|
70
|
+
<pre>
|
71
|
+
/resize/WIDTHx/id/name.jpg (ex: http://mugshot.ws/resize/200x/myid/thumb.jpg)
|
72
|
+
|
73
|
+
/resize/xHEIGHT/id/name.jpg (ex: http://mugshot.ws/resize/x100/myid/thumb.jpg)
|
74
|
+
</pre>
|
75
|
+
|
76
|
+
### Crop
|
77
|
+
|
78
|
+
<pre>
|
79
|
+
/crop/WIDTHxHEIGHT/id/name.jpg (ex: http://mugshot.ws/crop/200x100/myid/thumb.jpg)
|
80
|
+
</pre>
|
81
|
+
|
82
|
+
### Quality
|
83
|
+
|
84
|
+
<pre>
|
85
|
+
/quality/QUALITY/id/name.jpg (ex: http://mugshot.ws/quality/70/myid/thumb.jpg)
|
86
|
+
</pre>
|
87
|
+
|
88
|
+
### Background
|
89
|
+
|
90
|
+
<pre>
|
91
|
+
/background/COLOR/id/name.jpg (ex: http://mugshot.ws/background/red/myid/thumb.jpg)
|
92
|
+
</pre>
|
93
|
+
|
94
|
+
|
95
|
+
Configuration
|
96
|
+
-------------
|
97
|
+
|
98
|
+
You can further configure your Mugshot::Application when creating it, like so:
|
99
|
+
|
100
|
+
<pre>
|
101
|
+
# -*- encoding: utf-8 -*-
|
102
|
+
require "rubygems"
|
103
|
+
require "mugshot"
|
104
|
+
|
105
|
+
run Mugshot::Application.new(
|
106
|
+
:storage => Mugshot::FSStorage.new("/tmp/mugshot"),
|
107
|
+
:cache_duration => 7.days.to_i, # duration set in cache header (in seconds)
|
108
|
+
:allowed_sizes => ['640x360', '480x360', '320x240'], # an array with valid sizes for resize and crop operations
|
109
|
+
:allowed_formats => [:jpg, :png], # an array with the allowed formats
|
110
|
+
:allowed_names => ['thumb', 'img'], # an array with the allowed names in the URL
|
111
|
+
:quality_range => 1..100, # the range of allowed values for quality operations
|
112
|
+
:valid_operations => [:crop, :resize, :quality] # an array with the valid operations
|
113
|
+
)
|
114
|
+
</pre>
|
115
|
+
|
116
|
+
When using the restrictive configurations any value other than the ones allowed will result in a 400 status code being returned. If no restriction is set then any value can be given, which can lead to DOS attacks. Be careful!
|
117
|
+
|
118
|
+
Development
|
119
|
+
-----------
|
120
|
+
|
121
|
+
Clone the repository and run:
|
122
|
+
|
123
|
+
<pre>
|
124
|
+
$ bundle install
|
125
|
+
</pre>
|
126
|
+
|
127
|
+
This will install all dependencies for you. Then you can run the specs and features:
|
38
128
|
|
39
|
-
|
129
|
+
<pre>
|
130
|
+
$ rake spec
|
131
|
+
$ rake cucumber
|
132
|
+
</pre>
|
40
133
|
|
41
134
|
|
42
135
|
Who's using
|
data/features/support/env.rb
CHANGED
data/lib/mugshot/application.rb
CHANGED
@@ -3,15 +3,15 @@ require 'sinatra/base'
|
|
3
3
|
|
4
4
|
class Mugshot::Application < Sinatra::Base
|
5
5
|
|
6
|
-
|
6
|
+
DEFAULT_VALID_OPERATIONS = %w[background crop resize quality]
|
7
7
|
|
8
8
|
set :static, true
|
9
9
|
set :public, ::File.expand_path(::File.join(::File.dirname(__FILE__), "public"))
|
10
10
|
|
11
11
|
before do
|
12
|
-
response['Cache-Control'] = "public, max-age=#{
|
12
|
+
response['Cache-Control'] = "public, max-age=#{@cache_duration}"
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
get '/?' do
|
16
16
|
'ok'
|
17
17
|
end
|
@@ -22,13 +22,20 @@ class Mugshot::Application < Sinatra::Base
|
|
22
22
|
id
|
23
23
|
end
|
24
24
|
|
25
|
+
before '/*/?:id/:name.:format' do |splat, id, name, format|
|
26
|
+
@operations = operations_from_splat(splat)
|
27
|
+
check_format(format)
|
28
|
+
check_name(name)
|
29
|
+
check_operations
|
30
|
+
end
|
31
|
+
|
25
32
|
get '/*/?:id/:name.:format' do |splat, id, _, format|
|
26
33
|
image = @storage.read(id)
|
27
34
|
halt 404 if image.blank?
|
28
35
|
|
29
36
|
begin
|
30
37
|
process_operations(image, @default_operations)
|
31
|
-
process_operations(image,
|
38
|
+
process_operations(image, @operations)
|
32
39
|
send_image(image, format.to_sym)
|
33
40
|
ensure
|
34
41
|
image.destroy!
|
@@ -40,8 +47,14 @@ class Mugshot::Application < Sinatra::Base
|
|
40
47
|
def initialize(opts)
|
41
48
|
opts = {:storage => opts} if opts.kind_of?(Mugshot::Storage)
|
42
49
|
opts.to_options!
|
43
|
-
|
50
|
+
|
44
51
|
@storage = opts.delete(:storage)
|
52
|
+
@cache_duration = opts.delete(:cache_duration) || 1.year.to_i
|
53
|
+
@valid_operations = (opts.delete(:valid_operations) || DEFAULT_VALID_OPERATIONS).map(&:to_s)
|
54
|
+
@quality_range = opts.delete(:quality_range)
|
55
|
+
@allowed_sizes = opts.delete(:allowed_sizes)
|
56
|
+
@allowed_formats = opts.delete(:allowed_formats)
|
57
|
+
@allowed_names = opts.delete(:allowed_names)
|
45
58
|
|
46
59
|
@default_operations = opts
|
47
60
|
|
@@ -54,12 +67,48 @@ class Mugshot::Application < Sinatra::Base
|
|
54
67
|
operations = []
|
55
68
|
begin
|
56
69
|
operations = Hash[*splat.split('/')]
|
57
|
-
operations.assert_valid_keys(
|
70
|
+
operations.assert_valid_keys(@valid_operations)
|
58
71
|
rescue
|
59
|
-
halt
|
72
|
+
halt 400
|
60
73
|
end
|
61
74
|
operations
|
62
75
|
end
|
76
|
+
|
77
|
+
def check_format(format)
|
78
|
+
halt 400 unless valid_format?(format)
|
79
|
+
end
|
80
|
+
|
81
|
+
def valid_format?(format)
|
82
|
+
@allowed_formats.blank? || @allowed_formats.map(&:to_s).include?(format)
|
83
|
+
end
|
84
|
+
|
85
|
+
def check_name(name)
|
86
|
+
halt 400 unless valid_name?(name)
|
87
|
+
end
|
88
|
+
|
89
|
+
def valid_name?(name)
|
90
|
+
@allowed_names.blank? || @allowed_names.map(&:to_s).include?(name)
|
91
|
+
end
|
92
|
+
|
93
|
+
def check_operations
|
94
|
+
halt 400 unless valid_quality_operation? && valid_resize_operation? && valid_crop_operation?
|
95
|
+
end
|
96
|
+
|
97
|
+
def valid_quality_operation?
|
98
|
+
!@operations.has_key?("quality") || @quality_range.blank? || @quality_range.include?(@operations["quality"].to_i)
|
99
|
+
end
|
100
|
+
|
101
|
+
def valid_resize_operation?
|
102
|
+
valid_operation?("resize", @allowed_sizes)
|
103
|
+
end
|
104
|
+
|
105
|
+
def valid_crop_operation?
|
106
|
+
valid_operation?("crop", @allowed_sizes)
|
107
|
+
end
|
108
|
+
|
109
|
+
def valid_operation?(operation, range_or_array)
|
110
|
+
!@operations.has_key?(operation) || range_or_array.blank? || range_or_array.include?(@operations[operation])
|
111
|
+
end
|
63
112
|
|
64
113
|
def process_operations(image, operations)
|
65
114
|
operations.each do |op, op_params|
|
data/lib/mugshot/fs_storage.rb
CHANGED
@@ -3,8 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
3
3
|
|
4
4
|
describe Mugshot::Application do
|
5
5
|
before :each do
|
6
|
-
@storage = stub(Mugshot::Storage, :
|
7
|
-
@image = stub(Mugshot::Image, :
|
6
|
+
@storage = stub(Mugshot::Storage, :kind_of? => true).as_null_object
|
7
|
+
@image = stub(Mugshot::Image, :blank? => false).as_null_object
|
8
8
|
@storage.stub!(:read).with("image_id").and_return(@image)
|
9
9
|
|
10
10
|
def app
|
@@ -95,19 +95,19 @@ describe Mugshot::Application do
|
|
95
95
|
last_response.body.should be_empty
|
96
96
|
end
|
97
97
|
|
98
|
-
it "should halt
|
98
|
+
it "should halt 400 on operations that are not allowed" do
|
99
99
|
@image.should_not_receive(:operation!)
|
100
100
|
|
101
101
|
get "/operation/140x105/image_id/any_name.jpg"
|
102
102
|
|
103
|
-
last_response.should
|
103
|
+
last_response.status.should == 400
|
104
104
|
last_response.body.should be_empty
|
105
105
|
end
|
106
106
|
|
107
|
-
it "should halt
|
107
|
+
it "should halt 400 on URL with invalid operation/param pair" do
|
108
108
|
get "/140x105/image_id/any_name.jpg"
|
109
109
|
|
110
|
-
last_response.should
|
110
|
+
last_response.status.should == 400
|
111
111
|
last_response.body.should be_empty
|
112
112
|
end
|
113
113
|
end
|
@@ -127,4 +127,192 @@ describe Mugshot::Application do
|
|
127
127
|
last_response.headers["Cache-Control"].should == "public, max-age=31557600"
|
128
128
|
end
|
129
129
|
end
|
130
|
+
|
131
|
+
describe "configuration" do
|
132
|
+
describe "cache duration" do
|
133
|
+
it "should use the configured cache duration" do
|
134
|
+
def app
|
135
|
+
Mugshot::Application.new(:storage => @storage, :cache_duration => 3.days.to_i)
|
136
|
+
end
|
137
|
+
|
138
|
+
get "/"
|
139
|
+
last_response.headers["Cache-Control"].should == "public, max-age=#{3.days.to_i}"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "valid operations" do
|
144
|
+
it "should allow a valid operation" do
|
145
|
+
def app
|
146
|
+
Mugshot::Application.new(:storage => @storage, :valid_operations => ["crop", "resize"])
|
147
|
+
end
|
148
|
+
|
149
|
+
@image.stub!(:to_blob).and_return("image data")
|
150
|
+
|
151
|
+
get "/resize/200x100/image_id/any_name.jpg"
|
152
|
+
last_response.should be_ok
|
153
|
+
last_response.body.should == "image data"
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should halt with a 400 (Bad Request) when an invalid operation is given" do
|
157
|
+
def app
|
158
|
+
Mugshot::Application.new(:storage => @storage, :valid_operations => ["crop", "resize"])
|
159
|
+
end
|
160
|
+
|
161
|
+
get "/quality/50/image_id/any_name.jpg"
|
162
|
+
last_response.status.should == 400
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe "quality range" do
|
167
|
+
it "should allow quality operations with values in the configured range" do
|
168
|
+
def app
|
169
|
+
Mugshot::Application.new(:storage => @storage, :quality_range => 1..200)
|
170
|
+
end
|
171
|
+
|
172
|
+
@image.stub!(:to_blob).and_return("image data")
|
173
|
+
|
174
|
+
1.upto(200) do |quality|
|
175
|
+
get "/quality/#{quality}/image_id/any_name.jpg"
|
176
|
+
last_response.should be_ok
|
177
|
+
last_response.body.should == "image data"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should allow quality operations when no range is configured" do
|
182
|
+
@image.stub!(:to_blob).and_return("image data")
|
183
|
+
|
184
|
+
1.upto(300) do |quality|
|
185
|
+
get "/quality/#{quality}/image_id/any_name.jpg"
|
186
|
+
last_response.should be_ok
|
187
|
+
last_response.body.should == "image data"
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should halt with a 400 (Bad Request) quality operations with values outside the configured range" do
|
192
|
+
def app
|
193
|
+
Mugshot::Application.new(:storage => @storage, :quality_range => 1..200)
|
194
|
+
end
|
195
|
+
|
196
|
+
get "/quality/0/image_id/any_name.jpg"
|
197
|
+
last_response.status.should == 400
|
198
|
+
|
199
|
+
get "/quality/201/image_id/any_name.jpg"
|
200
|
+
last_response.status.should == 400
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
describe "allowed sizes" do
|
205
|
+
def allowed_sizes
|
206
|
+
['640x480', '640x360', '480x360', '320x240']
|
207
|
+
end
|
208
|
+
|
209
|
+
%w{resize crop}.each do |operation|
|
210
|
+
it "should allow #{operation} operations for configured values" do
|
211
|
+
def app
|
212
|
+
Mugshot::Application.new(:storage => @storage, :allowed_sizes => allowed_sizes)
|
213
|
+
end
|
214
|
+
|
215
|
+
@image.stub!(:to_blob).and_return("image data")
|
216
|
+
|
217
|
+
allowed_sizes.each do |size|
|
218
|
+
get "/#{operation}/#{size}/image_id/any_name.jpg"
|
219
|
+
last_response.should be_ok
|
220
|
+
last_response.body.should == "image data"
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
it "should allow #{operation} operations when allowed sizes is not configured" do
|
225
|
+
def app
|
226
|
+
Mugshot::Application.new(:storage => @storage)
|
227
|
+
end
|
228
|
+
|
229
|
+
@image.stub!(:to_blob).and_return("image data")
|
230
|
+
|
231
|
+
['300x200', '400x250'].each do |size|
|
232
|
+
get "/#{operation}/#{size}/image_id/any_name.jpg"
|
233
|
+
last_response.should be_ok
|
234
|
+
last_response.body.should == "image data"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should halt with a 400 (Bad Request) #{operation} operations with a not allowed size" do
|
239
|
+
def app
|
240
|
+
Mugshot::Application.new(:storage => @storage, :allowed_sizes => allowed_sizes)
|
241
|
+
end
|
242
|
+
|
243
|
+
get "/#{operation}/300x200/image_id/any_name.jpg"
|
244
|
+
last_response.status.should == 400
|
245
|
+
|
246
|
+
get "/#{operation}/480x300/image_id/any_name.jpg"
|
247
|
+
last_response.status.should == 400
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
describe "allowed formats" do
|
253
|
+
it "should allow valid formats" do
|
254
|
+
def app
|
255
|
+
Mugshot::Application.new(:storage => @storage, :allowed_formats => ["jpg", "png"])
|
256
|
+
end
|
257
|
+
|
258
|
+
@image.stub!(:to_blob).and_return("image data")
|
259
|
+
|
260
|
+
["jpg", "png"].each do |format|
|
261
|
+
get "/image_id/any_name.#{format}"
|
262
|
+
last_response.should be_ok
|
263
|
+
last_response.body.should == "image data"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
it "should allow any format when no allowed format is configured" do
|
268
|
+
@image.stub!(:to_blob).and_return("image data")
|
269
|
+
|
270
|
+
get "/image_id/any_name.tiff"
|
271
|
+
last_response.should be_ok
|
272
|
+
last_response.body.should == "image data"
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should halt with a 400 (Bad Request) when an invalid format is given" do
|
276
|
+
def app
|
277
|
+
Mugshot::Application.new(:storage => @storage, :allowed_formats => ["jpg", "png"])
|
278
|
+
end
|
279
|
+
|
280
|
+
get "image_id/any_name.tiff"
|
281
|
+
last_response.status.should == 400
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
describe "allowed names" do
|
286
|
+
it "should allow valid names" do
|
287
|
+
def app
|
288
|
+
Mugshot::Application.new(:storage => @storage, :allowed_names => ["some_name", "some_other_name"])
|
289
|
+
end
|
290
|
+
|
291
|
+
@image.stub!(:to_blob).and_return("image data")
|
292
|
+
|
293
|
+
["some_name", "some_other_name"].each do |name|
|
294
|
+
get "/image_id/#{name}.jpg"
|
295
|
+
last_response.should be_ok
|
296
|
+
last_response.body.should == "image data"
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should allow any name when no allowed name is configured" do
|
301
|
+
@image.stub!(:to_blob).and_return("image data")
|
302
|
+
|
303
|
+
get "/image_id/any_name.tiff"
|
304
|
+
last_response.should be_ok
|
305
|
+
last_response.body.should == "image data"
|
306
|
+
end
|
307
|
+
|
308
|
+
it "should halt with a 400 (Bad Request) when an invalid name is given" do
|
309
|
+
def app
|
310
|
+
Mugshot::Application.new(:storage => @storage, :allowed_names => ["some_name", "some_other_name"])
|
311
|
+
end
|
312
|
+
|
313
|
+
get "image_id/any_name.tiff"
|
314
|
+
last_response.status.should == 400
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
130
318
|
end
|
data/spec/mugshot/image_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
|
4
4
|
describe Mugshot::Image do
|
5
5
|
before :each do
|
6
|
-
@magick_image = mock(Magick::Image, :
|
6
|
+
@magick_image = mock(Magick::Image, :columns => 100, :rows => 100).as_null_object
|
7
7
|
@magick_image.instance_eval do # TODO: Explain it
|
8
8
|
def to_blob(&block)
|
9
9
|
block.call if block.present?
|
metadata
CHANGED
@@ -1,32 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mugshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- "Cain\xC3\xA3 Nunes"
|
13
14
|
- "Fabr\xC3\xADcio Lopes"
|
14
15
|
- Guilherme Cirne
|
15
16
|
- Jose Peleteiro
|
17
|
+
- Vicente Mundim
|
16
18
|
autorequire:
|
17
19
|
bindir: bin
|
18
20
|
cert_chain: []
|
19
21
|
|
20
|
-
date: 2010-
|
22
|
+
date: 2010-12-28 00:00:00 -02:00
|
21
23
|
default_executable:
|
22
24
|
dependencies:
|
23
25
|
- !ruby/object:Gem::Dependency
|
24
26
|
name: activesupport
|
25
27
|
prerelease: false
|
26
28
|
requirement: &id001 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
27
30
|
requirements:
|
28
31
|
- - ~>
|
29
32
|
- !ruby/object:Gem::Version
|
33
|
+
hash: 9
|
30
34
|
segments:
|
31
35
|
- 2
|
32
36
|
- 3
|
@@ -35,69 +39,79 @@ dependencies:
|
|
35
39
|
type: :runtime
|
36
40
|
version_requirements: *id001
|
37
41
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
42
|
+
name: rmagick
|
39
43
|
prerelease: false
|
40
44
|
requirement: &id002 !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
41
46
|
requirements:
|
42
47
|
- - ">="
|
43
48
|
- !ruby/object:Gem::Version
|
49
|
+
hash: 59
|
44
50
|
segments:
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
version:
|
51
|
+
- 2
|
52
|
+
- 12
|
53
|
+
- 2
|
54
|
+
version: 2.12.2
|
49
55
|
type: :runtime
|
50
56
|
version_requirements: *id002
|
51
57
|
- !ruby/object:Gem::Dependency
|
52
|
-
name:
|
58
|
+
name: uuid
|
53
59
|
prerelease: false
|
54
60
|
requirement: &id003 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
55
62
|
requirements:
|
56
63
|
- - ">="
|
57
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 11
|
58
66
|
segments:
|
59
67
|
- 2
|
60
|
-
-
|
68
|
+
- 0
|
61
69
|
- 2
|
62
|
-
version: 2.
|
70
|
+
version: 2.0.2
|
63
71
|
type: :runtime
|
64
72
|
version_requirements: *id003
|
65
73
|
- !ruby/object:Gem::Dependency
|
66
|
-
name:
|
74
|
+
name: blankslate
|
67
75
|
prerelease: false
|
68
76
|
requirement: &id004 !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
69
78
|
requirements:
|
70
79
|
- - ">="
|
71
80
|
- !ruby/object:Gem::Version
|
81
|
+
hash: 105
|
72
82
|
segments:
|
73
83
|
- 2
|
74
|
-
-
|
84
|
+
- 1
|
75
85
|
- 2
|
76
|
-
|
86
|
+
- 3
|
87
|
+
version: 2.1.2.3
|
77
88
|
type: :runtime
|
78
89
|
version_requirements: *id004
|
79
90
|
- !ruby/object:Gem::Dependency
|
80
|
-
name:
|
91
|
+
name: sinatra
|
81
92
|
prerelease: false
|
82
93
|
requirement: &id005 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
83
95
|
requirements:
|
84
96
|
- - ">="
|
85
97
|
- !ruby/object:Gem::Version
|
98
|
+
hash: 51
|
86
99
|
segments:
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
|
91
|
-
version: 2.1.2.3
|
100
|
+
- 0
|
101
|
+
- 9
|
102
|
+
- 4
|
103
|
+
version: 0.9.4
|
92
104
|
type: :runtime
|
93
105
|
version_requirements: *id005
|
94
106
|
- !ruby/object:Gem::Dependency
|
95
107
|
name: fakeweb
|
96
108
|
prerelease: false
|
97
109
|
requirement: &id006 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
98
111
|
requirements:
|
99
112
|
- - ">="
|
100
113
|
- !ruby/object:Gem::Version
|
114
|
+
hash: 3
|
101
115
|
segments:
|
102
116
|
- 0
|
103
117
|
version: "0"
|
@@ -107,25 +121,27 @@ dependencies:
|
|
107
121
|
name: rspec
|
108
122
|
prerelease: false
|
109
123
|
requirement: &id007 !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
110
125
|
requirements:
|
111
126
|
- - ">="
|
112
127
|
- !ruby/object:Gem::Version
|
128
|
+
hash: 3
|
113
129
|
segments:
|
114
130
|
- 2
|
131
|
+
- 3
|
115
132
|
- 0
|
116
|
-
|
117
|
-
- beta
|
118
|
-
- 8
|
119
|
-
version: 2.0.0.beta.8
|
133
|
+
version: 2.3.0
|
120
134
|
type: :development
|
121
135
|
version_requirements: *id007
|
122
136
|
- !ruby/object:Gem::Dependency
|
123
137
|
name: rcov
|
124
138
|
prerelease: false
|
125
139
|
requirement: &id008 !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
126
141
|
requirements:
|
127
142
|
- - ">="
|
128
143
|
- !ruby/object:Gem::Version
|
144
|
+
hash: 43
|
129
145
|
segments:
|
130
146
|
- 0
|
131
147
|
- 9
|
@@ -137,9 +153,11 @@ dependencies:
|
|
137
153
|
name: cucumber
|
138
154
|
prerelease: false
|
139
155
|
requirement: &id009 !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
140
157
|
requirements:
|
141
158
|
- - ">="
|
142
159
|
- !ruby/object:Gem::Version
|
160
|
+
hash: 3
|
143
161
|
segments:
|
144
162
|
- 0
|
145
163
|
- 6
|
@@ -151,9 +169,11 @@ dependencies:
|
|
151
169
|
name: rack-test
|
152
170
|
prerelease: false
|
153
171
|
requirement: &id010 !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
154
173
|
requirements:
|
155
174
|
- - ">="
|
156
175
|
- !ruby/object:Gem::Version
|
176
|
+
hash: 9
|
157
177
|
segments:
|
158
178
|
- 0
|
159
179
|
- 5
|
@@ -161,12 +181,13 @@ dependencies:
|
|
161
181
|
version: 0.5.1
|
162
182
|
type: :development
|
163
183
|
version_requirements: *id010
|
164
|
-
description:
|
184
|
+
description: "The basic idea of Mugshot is that you upload the largest/highest quality images possible. When retrieving the images you apply different operations to it such as: resizing, rounded corners, transparency and anything else we can think of!"
|
165
185
|
email:
|
166
186
|
- cainanunes@gmail.com
|
167
187
|
- fabriciolopesvital@gmail.com
|
168
188
|
- gcirne@gmail.com
|
169
189
|
- jose@peleteiro.net
|
190
|
+
- vicente.mundim@gmail.com
|
170
191
|
executables: []
|
171
192
|
|
172
193
|
extensions: []
|
@@ -183,8 +204,38 @@ files:
|
|
183
204
|
- lib/mugshot/magick_factory.rb
|
184
205
|
- lib/mugshot/public/crossdomain.xml
|
185
206
|
- lib/mugshot/storage.rb
|
207
|
+
- lib/mugshot/version.rb
|
186
208
|
- LICENSE
|
187
209
|
- README.md
|
210
|
+
- features/convert_image_format.feature
|
211
|
+
- features/crop_image.feature
|
212
|
+
- features/define_image_quality.feature
|
213
|
+
- features/resize_image.feature
|
214
|
+
- features/retrieve_image_with_any_name.feature
|
215
|
+
- features/set_background.feature
|
216
|
+
- features/step_definitions/all_steps.rb
|
217
|
+
- features/support/env.rb
|
218
|
+
- features/support/files/test-cropped_to_300x200.jpg
|
219
|
+
- features/support/files/test-resized_to_200x.jpg
|
220
|
+
- features/support/files/test-resized_to_200x200.jpg
|
221
|
+
- features/support/files/test-resized_to_x200.jpg
|
222
|
+
- features/support/files/test-with_75%_of_compression.jpg
|
223
|
+
- features/support/files/test.gif
|
224
|
+
- features/support/files/test.jpg
|
225
|
+
- features/support/files/test.png
|
226
|
+
- features/support/files/with_alpha_channel-with_a_red_background.jpg
|
227
|
+
- features/support/files/with_alpha_channel.png
|
228
|
+
- features/upload_image.feature
|
229
|
+
- spec/files/firefox_png.png
|
230
|
+
- spec/files/test.jpg
|
231
|
+
- spec/files/test_png.png
|
232
|
+
- spec/mugshot/application_spec.rb
|
233
|
+
- spec/mugshot/fs_storage_spec.rb
|
234
|
+
- spec/mugshot/http_storage_spec.rb
|
235
|
+
- spec/mugshot/image_spec.rb
|
236
|
+
- spec/mugshot/magick_factory_spec.rb
|
237
|
+
- spec/spec_helper.rb
|
238
|
+
- spec/test.html
|
188
239
|
has_rdoc: true
|
189
240
|
homepage: http://mugshot.ws
|
190
241
|
licenses: []
|
@@ -195,37 +246,31 @@ rdoc_options:
|
|
195
246
|
require_paths:
|
196
247
|
- lib
|
197
248
|
required_ruby_version: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
198
250
|
requirements:
|
199
251
|
- - ">="
|
200
252
|
- !ruby/object:Gem::Version
|
253
|
+
hash: 3
|
201
254
|
segments:
|
202
255
|
- 0
|
203
256
|
version: "0"
|
204
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
258
|
+
none: false
|
205
259
|
requirements:
|
206
260
|
- - ">="
|
207
261
|
- !ruby/object:Gem::Version
|
262
|
+
hash: 3
|
208
263
|
segments:
|
209
264
|
- 0
|
210
265
|
version: "0"
|
211
266
|
requirements: []
|
212
267
|
|
213
|
-
rubyforge_project:
|
214
|
-
rubygems_version: 1.3.
|
268
|
+
rubyforge_project: mugshot
|
269
|
+
rubygems_version: 1.3.7
|
215
270
|
signing_key:
|
216
271
|
specification_version: 3
|
217
272
|
summary: Dead simple image server
|
218
273
|
test_files:
|
219
|
-
- spec/files/firefox_png.png
|
220
|
-
- spec/files/test.jpg
|
221
|
-
- spec/files/test_png.png
|
222
|
-
- spec/mugshot/application_spec.rb
|
223
|
-
- spec/mugshot/fs_storage_spec.rb
|
224
|
-
- spec/mugshot/http_storage_spec.rb
|
225
|
-
- spec/mugshot/image_spec.rb
|
226
|
-
- spec/mugshot/magick_factory_spec.rb
|
227
|
-
- spec/spec_helper.rb
|
228
|
-
- spec/test.html
|
229
274
|
- features/convert_image_format.feature
|
230
275
|
- features/crop_image.feature
|
231
276
|
- features/define_image_quality.feature
|
@@ -245,3 +290,13 @@ test_files:
|
|
245
290
|
- features/support/files/with_alpha_channel-with_a_red_background.jpg
|
246
291
|
- features/support/files/with_alpha_channel.png
|
247
292
|
- features/upload_image.feature
|
293
|
+
- spec/files/firefox_png.png
|
294
|
+
- spec/files/test.jpg
|
295
|
+
- spec/files/test_png.png
|
296
|
+
- spec/mugshot/application_spec.rb
|
297
|
+
- spec/mugshot/fs_storage_spec.rb
|
298
|
+
- spec/mugshot/http_storage_spec.rb
|
299
|
+
- spec/mugshot/image_spec.rb
|
300
|
+
- spec/mugshot/magick_factory_spec.rb
|
301
|
+
- spec/spec_helper.rb
|
302
|
+
- spec/test.html
|