image8 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/image8.gemspec +1 -1
- data/lib/image8.rb +11 -1
- metadata +20 -3
data/image8.gemspec
CHANGED
data/lib/image8.rb
CHANGED
@@ -12,7 +12,7 @@ class Image8 < Sinatra::Base
|
|
12
12
|
|
13
13
|
register Sinatra::Async
|
14
14
|
|
15
|
-
aget %r[/(resize|crop)/([0-9x]+)/(.*)] do |action, format, uri|
|
15
|
+
aget %r[/(resize|crop|max)/([0-9x]+)/(.*)] do |action, format, uri|
|
16
16
|
EM.synchrony do
|
17
17
|
puts "uri: #{uri.inspect} - #{uri.class}"
|
18
18
|
|
@@ -103,6 +103,16 @@ class Image8 < Sinatra::Base
|
|
103
103
|
when "crop" then
|
104
104
|
width, height = format.split("x").map {|x| x.to_i}
|
105
105
|
image.resize_to_fill! width, height
|
106
|
+
when "max" then
|
107
|
+
width, height = format.split("x").map {|x| x.to_i}
|
108
|
+
actual_width = image.rows
|
109
|
+
actual_height = image.columns
|
110
|
+
|
111
|
+
if( actual_width > width || actual_height > height )
|
112
|
+
image.change_geometry!(format) {|width, height|
|
113
|
+
image.resize! width, height
|
114
|
+
}
|
115
|
+
end
|
106
116
|
end
|
107
117
|
image
|
108
118
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image8
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
9
|
+
- 5
|
10
|
+
version: 0.3.5
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Harry Vangberg
|
@@ -21,9 +22,11 @@ dependencies:
|
|
21
22
|
name: sinatra
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 0
|
@@ -34,9 +37,11 @@ dependencies:
|
|
34
37
|
name: async_sinatra
|
35
38
|
prerelease: false
|
36
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
37
41
|
requirements:
|
38
42
|
- - ">="
|
39
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 21
|
40
45
|
segments:
|
41
46
|
- 0
|
42
47
|
- 2
|
@@ -48,9 +53,11 @@ dependencies:
|
|
48
53
|
name: em-http-request
|
49
54
|
prerelease: false
|
50
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
51
57
|
requirements:
|
52
58
|
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 25
|
54
61
|
segments:
|
55
62
|
- 0
|
56
63
|
- 2
|
@@ -62,9 +69,11 @@ dependencies:
|
|
62
69
|
name: em-synchrony
|
63
70
|
prerelease: false
|
64
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
65
73
|
requirements:
|
66
74
|
- - ">="
|
67
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 17
|
68
77
|
segments:
|
69
78
|
- 0
|
70
79
|
- 1
|
@@ -76,9 +85,11 @@ dependencies:
|
|
76
85
|
name: json
|
77
86
|
prerelease: false
|
78
87
|
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
79
89
|
requirements:
|
80
90
|
- - ">="
|
81
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
82
93
|
segments:
|
83
94
|
- 0
|
84
95
|
version: "0"
|
@@ -88,9 +99,11 @@ dependencies:
|
|
88
99
|
name: rmagick
|
89
100
|
prerelease: false
|
90
101
|
requirement: &id006 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
91
103
|
requirements:
|
92
104
|
- - ">="
|
93
105
|
- !ruby/object:Gem::Version
|
106
|
+
hash: 57
|
94
107
|
segments:
|
95
108
|
- 2
|
96
109
|
- 13
|
@@ -121,23 +134,27 @@ rdoc_options: []
|
|
121
134
|
require_paths:
|
122
135
|
- lib
|
123
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
124
138
|
requirements:
|
125
139
|
- - ">="
|
126
140
|
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
127
142
|
segments:
|
128
143
|
- 0
|
129
144
|
version: "0"
|
130
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
131
147
|
requirements:
|
132
148
|
- - ">="
|
133
149
|
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
134
151
|
segments:
|
135
152
|
- 0
|
136
153
|
version: "0"
|
137
154
|
requirements: []
|
138
155
|
|
139
156
|
rubyforge_project:
|
140
|
-
rubygems_version: 1.3.
|
157
|
+
rubygems_version: 1.3.7
|
141
158
|
signing_key:
|
142
159
|
specification_version: 3
|
143
160
|
summary: dynamic image resizing.
|