mugshot 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mugshot/application.rb +8 -9
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/mugshot/application.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
|
3
3
|
class Mugshot::Application < Sinatra::Base
|
4
|
-
|
4
|
+
|
5
5
|
set :static, true
|
6
6
|
set :public, ::File.expand_path(::File.join(::File.dirname(__FILE__), "public"))
|
7
7
|
|
@@ -9,11 +9,15 @@ class Mugshot::Application < Sinatra::Base
|
|
9
9
|
content_type :jpg
|
10
10
|
end
|
11
11
|
|
12
|
+
get '/?' do
|
13
|
+
'ok'
|
14
|
+
end
|
15
|
+
|
12
16
|
post '/?' do
|
13
17
|
content_type :html
|
14
18
|
@storage.write(params['file'][:tempfile].read)
|
15
19
|
end
|
16
|
-
|
20
|
+
|
17
21
|
get '/:size/:id.:ext' do |size, id, ext|
|
18
22
|
image = @storage.read(id)
|
19
23
|
|
@@ -23,19 +27,14 @@ class Mugshot::Application < Sinatra::Base
|
|
23
27
|
image.resize! dimm
|
24
28
|
image.to_blob
|
25
29
|
end
|
26
|
-
|
30
|
+
|
27
31
|
get '/:id.:ext' do |id, ext|
|
28
32
|
image = @storage.read(id)
|
29
33
|
halt 404 if image.nil?
|
30
34
|
image.to_blob
|
31
35
|
end
|
32
|
-
|
33
|
-
get '/' do
|
34
|
-
'ok'
|
35
|
-
end
|
36
|
-
|
37
|
-
protected
|
38
36
|
|
37
|
+
protected
|
39
38
|
def initialize(storage)
|
40
39
|
@storage = storage
|
41
40
|
end
|