httpimagestore 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +5 -2
- data/Gemfile.lock +24 -14
- data/README.md +161 -105
- data/bin/httpimagestore +6 -2
- data/features/cache-control.feature +2 -2
- data/features/compatibility.feature +4 -4
- data/features/error-reporting.feature +49 -3
- data/features/flexi.feature +260 -0
- data/features/s3-store-and-thumbnail.feature +1 -1
- data/features/step_definitions/httpimagestore_steps.rb +24 -0
- data/features/storage.feature +199 -0
- data/features/support/test-large.jpg +0 -0
- data/features/support/test.png +0 -0
- data/httpimagestore.gemspec +13 -9
- data/lib/httpimagestore/configuration/file.rb +1 -1
- data/lib/httpimagestore/configuration/handler.rb +114 -20
- data/lib/httpimagestore/configuration/identify.rb +56 -0
- data/lib/httpimagestore/configuration/path.rb +7 -28
- data/lib/httpimagestore/configuration/s3.rb +230 -12
- data/lib/httpimagestore/configuration/thumbnailer.rb +17 -8
- data/lib/httpimagestore/error_reporter.rb +1 -11
- data/load_test/load_test.jmx +11 -11
- data/load_test/thumbnail_specs.csv +11 -11
- data/spec/configuration_file_spec.rb +20 -20
- data/spec/configuration_handler_spec.rb +156 -6
- data/spec/configuration_identify_spec.rb +45 -0
- data/spec/configuration_output_spec.rb +15 -15
- data/spec/configuration_path_spec.rb +70 -23
- data/spec/configuration_s3_spec.rb +187 -28
- data/spec/configuration_thumbnailer_spec.rb +22 -22
- data/spec/spec_helper.rb +11 -2
- data/spec/support/full.cfg +4 -4
- metadata +12 -8
- data/features/facebook.feature +0 -149
@@ -0,0 +1,260 @@
|
|
1
|
+
Feature: Flexible API with two storage options and Facebook like thumbnailing URL format
|
2
|
+
Features two storage apporaches: with JPEG conversion and limiting in size - for user provided content - and storing literaly.
|
3
|
+
POST requests will end up with server side generated storage key based on input data digest.
|
4
|
+
PUT requsts can be used to store image under provided storage key.
|
5
|
+
Thumbnail GET API is similart to described in https://developers.facebook.com/docs/reference/api/using-pictures/#sizes.
|
6
|
+
Stored object extension and content type is determined from image data.
|
7
|
+
|
8
|
+
Background:
|
9
|
+
Given S3 settings in AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_S3_TEST_BUCKET environment variables
|
10
|
+
Given httpthumbnailer server is running at http://localhost:3100/health_check
|
11
|
+
Given httpimagestore server is running at http://localhost:3000/health_check with the following configuration
|
12
|
+
"""
|
13
|
+
s3 key="@AWS_ACCESS_KEY_ID@" secret="@AWS_SECRET_ACCESS_KEY@" ssl=false
|
14
|
+
|
15
|
+
path "hash" "#{input_digest}.#{image_mime_extension}"
|
16
|
+
path "path" "#{path}"
|
17
|
+
|
18
|
+
## User uploaded content - always JPEG converted, not bigger than 2160x2160 and in hight quality compression
|
19
|
+
post "pictures" {
|
20
|
+
thumbnail "input" "original" operation="limit" width=2160 height=2160 format="jpeg" quality=95
|
21
|
+
store_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="hash"
|
22
|
+
output_store_path "original"
|
23
|
+
}
|
24
|
+
|
25
|
+
put "pictures" {
|
26
|
+
thumbnail "input" "original" operation="limit" width=2160 height=2160 format="jpeg" quality=95
|
27
|
+
store_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
28
|
+
output_store_path "original"
|
29
|
+
}
|
30
|
+
|
31
|
+
## Uploaded by us for use on the website - whatever we send
|
32
|
+
post "images" {
|
33
|
+
identify "input"
|
34
|
+
store_s3 "input" bucket="@AWS_S3_TEST_BUCKET@" path="hash"
|
35
|
+
output_store_path "input"
|
36
|
+
}
|
37
|
+
|
38
|
+
put "images" {
|
39
|
+
identify "input"
|
40
|
+
store_s3 "input" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
41
|
+
output_store_path "input"
|
42
|
+
}
|
43
|
+
|
44
|
+
## Thumbailing - keep input format; default JPEG quality is 85
|
45
|
+
get "pictures" "&:width" "&:height" "&:operation?crop" "&:background-color?white" {
|
46
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
47
|
+
thumbnail "original" "thumbnail" operation="#{operation}" width="#{width}" height="#{height}" options="background-color:#{background-color}"
|
48
|
+
output_image "thumbnail" cache-control="public, max-age=31557600, s-maxage=0"
|
49
|
+
}
|
50
|
+
|
51
|
+
get "pictures" "&:width" "&:height?1080" "&:operation?fit" "&:background-color?white" {
|
52
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
53
|
+
thumbnail "original" "thumbnail" operation="#{operation}" width="#{width}" height="#{height}" options="background-color:#{background-color}"
|
54
|
+
output_image "thumbnail" cache-control="public, max-age=31557600, s-maxage=0"
|
55
|
+
}
|
56
|
+
|
57
|
+
get "pictures" "&:height" "&:width?1080" "&:operation?fit" "&:background-color?white" {
|
58
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
59
|
+
thumbnail "original" "thumbnail" operation="#{operation}" width="#{width}" height="#{height}" options="background-color:#{background-color}"
|
60
|
+
output_image "thumbnail" cache-control="public, max-age=31557600, s-maxage=0"
|
61
|
+
}
|
62
|
+
|
63
|
+
get "pictures" "&type=square" {
|
64
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
65
|
+
thumbnail "original" "thumbnail" operation="crop" width="50" height="50"
|
66
|
+
output_image "thumbnail" cache-control="public, max-age=31557600, s-maxage=0"
|
67
|
+
}
|
68
|
+
|
69
|
+
get "pictures" "&type=small" {
|
70
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
71
|
+
thumbnail "original" "thumbnail" operation="fit" width="50" height="2000"
|
72
|
+
output_image "thumbnail" cache-control="public, max-age=31557600, s-maxage=0"
|
73
|
+
}
|
74
|
+
|
75
|
+
get "pictures" "&type=normall" {
|
76
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
77
|
+
thumbnail "original" "thumbnail" operation="fit" width="100" height="2000"
|
78
|
+
output_image "thumbnail" cache-control="public, max-age=31557600, s-maxage=0"
|
79
|
+
}
|
80
|
+
|
81
|
+
get "pictures" "&type=large" {
|
82
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
83
|
+
thumbnail "original" "thumbnail" operation="fit" width="200" height="2000"
|
84
|
+
output_image "thumbnail" cache-control="public, max-age=31557600, s-maxage=0"
|
85
|
+
}
|
86
|
+
|
87
|
+
## By default serve original image
|
88
|
+
get "pictures" {
|
89
|
+
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="path"
|
90
|
+
output_image "original" cache-control="public, max-age=31557600, s-maxage=0"
|
91
|
+
}
|
92
|
+
"""
|
93
|
+
|
94
|
+
@flexi @pictures @post
|
95
|
+
Scenario: Posting picture to S3 bucket will store it under input data digest, limit to 2160x1260 and converted to JPEG
|
96
|
+
Given there is no 625d51a1820b607f.jpg file in S3 bucket
|
97
|
+
Given test-large.jpg file content as request body
|
98
|
+
When I do POST request http://localhost:3000/pictures
|
99
|
+
Then response status will be 200
|
100
|
+
And response content type will be text/plain
|
101
|
+
And response body will be CRLF ended lines
|
102
|
+
"""
|
103
|
+
625d51a1820b607f.jpg
|
104
|
+
"""
|
105
|
+
Then S3 object 625d51a1820b607f.jpg will contain JPEG image of size 1529x2160
|
106
|
+
Then S3 object 625d51a1820b607f.jpg content type will be image/jpeg
|
107
|
+
When I do GET request http://@AWS_S3_TEST_BUCKET@.s3.amazonaws.com/625d51a1820b607f.jpg
|
108
|
+
Then response status will be 403
|
109
|
+
Given there is no b0fe25319ba5909a.jpg file in S3 bucket
|
110
|
+
Given test.png file content as request body
|
111
|
+
When I do POST request http://localhost:3000/pictures
|
112
|
+
Then response status will be 200
|
113
|
+
And response content type will be text/plain
|
114
|
+
And response body will be CRLF ended lines
|
115
|
+
"""
|
116
|
+
b0fe25319ba5909a.jpg
|
117
|
+
"""
|
118
|
+
Then S3 object b0fe25319ba5909a.jpg will contain JPEG image of size 509x719
|
119
|
+
Then S3 object b0fe25319ba5909a.jpg content type will be image/jpeg
|
120
|
+
When I do GET request http://@AWS_S3_TEST_BUCKET@.s3.amazonaws.com/b0fe25319ba5909a.jpg
|
121
|
+
Then response status will be 403
|
122
|
+
|
123
|
+
@flexi @pictures @put
|
124
|
+
Scenario: Putting picture to S3 bucket will store it under provided path, limit it to 2160x1260 and converted to JPEG
|
125
|
+
Given there is no hello/world file in S3 bucket
|
126
|
+
Given test-large.jpg file content as request body
|
127
|
+
When I do PUT request http://localhost:3000/pictures/hello/world
|
128
|
+
Then response status will be 200
|
129
|
+
And response content type will be text/plain
|
130
|
+
And response body will be CRLF ended lines
|
131
|
+
"""
|
132
|
+
hello/world
|
133
|
+
"""
|
134
|
+
Then S3 object hello/world will contain JPEG image of size 1529x2160
|
135
|
+
Then S3 object hello/world content type will be image/jpeg
|
136
|
+
When I do GET request http://@AWS_S3_TEST_BUCKET@.s3.amazonaws.com/hello/world
|
137
|
+
Then response status will be 403
|
138
|
+
Given test.png file content as request body
|
139
|
+
When I do PUT request http://localhost:3000/pictures/hello/world
|
140
|
+
Then response status will be 200
|
141
|
+
And response content type will be text/plain
|
142
|
+
And response body will be CRLF ended lines
|
143
|
+
"""
|
144
|
+
hello/world
|
145
|
+
"""
|
146
|
+
Then S3 object hello/world will contain JPEG image of size 509x719
|
147
|
+
Then S3 object hello/world content type will be image/jpeg
|
148
|
+
When I do GET request http://@AWS_S3_TEST_BUCKET@.s3.amazonaws.com/hello/world
|
149
|
+
Then response status will be 403
|
150
|
+
|
151
|
+
@flexi @images @post
|
152
|
+
Scenario: Posting picture to S3 bucket will store it under first input data digest
|
153
|
+
Given there is no b0fe25319ba5909a.png file in S3 bucket
|
154
|
+
Given test.png file content as request body
|
155
|
+
When I do POST request http://localhost:3000/images
|
156
|
+
Then response status will be 200
|
157
|
+
And response content type will be text/plain
|
158
|
+
And response body will be CRLF ended lines
|
159
|
+
"""
|
160
|
+
b0fe25319ba5909a.png
|
161
|
+
"""
|
162
|
+
Then S3 object b0fe25319ba5909a.png will contain PNG image of size 509x719
|
163
|
+
Then S3 object b0fe25319ba5909a.png content type will be image/png
|
164
|
+
When I do GET request http://@AWS_S3_TEST_BUCKET@.s3.amazonaws.com/b0fe25319ba5909a.png
|
165
|
+
Then response status will be 403
|
166
|
+
|
167
|
+
@flexi @images @put
|
168
|
+
Scenario: Putting picture to S3 bucket will store it under provided path
|
169
|
+
Given there is no hello/world file in S3 bucket
|
170
|
+
Given test.png file content as request body
|
171
|
+
When I do PUT request http://localhost:3000/images/hello/world
|
172
|
+
Then response status will be 200
|
173
|
+
And response content type will be text/plain
|
174
|
+
And response body will be CRLF ended lines
|
175
|
+
"""
|
176
|
+
hello/world
|
177
|
+
"""
|
178
|
+
Then S3 object hello/world will contain PNG image of size 509x719
|
179
|
+
Then S3 object hello/world content type will be image/png
|
180
|
+
When I do GET request http://@AWS_S3_TEST_BUCKET@.s3.amazonaws.com/hello/world
|
181
|
+
Then response status will be 403
|
182
|
+
|
183
|
+
@flexi @default
|
184
|
+
Scenario: Getting stored image when no query string param is present
|
185
|
+
Given test.png file content as request body
|
186
|
+
When I do PUT request http://localhost:3000/images/test.png
|
187
|
+
And I do GET request http://localhost:3000/pictures/test.png
|
188
|
+
Then response status will be 200
|
189
|
+
And response content type will be image/png
|
190
|
+
Then response body will contain PNG image of size 509x719
|
191
|
+
Given test.jpg file content as request body
|
192
|
+
When I do PUT request http://localhost:3000/images/test.jpg
|
193
|
+
And I do GET request http://localhost:3000/pictures/test.jpg
|
194
|
+
Then response status will be 200
|
195
|
+
And response content type will be image/jpeg
|
196
|
+
Then response body will contain JPEG image of size 509x719
|
197
|
+
|
198
|
+
@flexi @type
|
199
|
+
Scenario: Getting square type tumbnail
|
200
|
+
Given test.png file content as request body
|
201
|
+
When I do PUT request http://localhost:3000/images/test.png
|
202
|
+
And I do GET request http://localhost:3000/pictures/test.png?type=square
|
203
|
+
Then response status will be 200
|
204
|
+
And response content type will be image/png
|
205
|
+
Then response body will contain PNG image of size 50x50
|
206
|
+
|
207
|
+
@flexi @type
|
208
|
+
Scenario: Getting small type tumbnail
|
209
|
+
Given test.png file content as request body
|
210
|
+
When I do PUT request http://localhost:3000/images/test.png
|
211
|
+
And I do GET request http://localhost:3000/pictures/test.png?type=small
|
212
|
+
Then response status will be 200
|
213
|
+
And response content type will be image/png
|
214
|
+
Then response body will contain PNG image of size 50x71
|
215
|
+
|
216
|
+
@flexi @type
|
217
|
+
Scenario: Getting normall type tumbnail
|
218
|
+
Given test.png file content as request body
|
219
|
+
When I do PUT request http://localhost:3000/images/test.png
|
220
|
+
And I do GET request http://localhost:3000/pictures/test.png?type=normall
|
221
|
+
Then response status will be 200
|
222
|
+
And response content type will be image/png
|
223
|
+
Then response body will contain PNG image of size 100x141
|
224
|
+
|
225
|
+
@flexi @type
|
226
|
+
Scenario: Getting large type tumbnail
|
227
|
+
Given test.png file content as request body
|
228
|
+
When I do PUT request http://localhost:3000/images/test.png
|
229
|
+
And I do GET request http://localhost:3000/pictures/test.png?type=large
|
230
|
+
Then response status will be 200
|
231
|
+
And response content type will be image/png
|
232
|
+
Then response body will contain PNG image of size 200x283
|
233
|
+
|
234
|
+
@flexi @size
|
235
|
+
Scenario: Getting custom size tumbnail
|
236
|
+
Given test.png file content as request body
|
237
|
+
When I do PUT request http://localhost:3000/images/test.png
|
238
|
+
And I do GET request http://localhost:3000/pictures/test.png?width=123&height=321
|
239
|
+
Then response status will be 200
|
240
|
+
And response content type will be image/png
|
241
|
+
Then response body will contain PNG image of size 123x321
|
242
|
+
|
243
|
+
@flexi @size
|
244
|
+
Scenario: Getting custom size tumbnail without height
|
245
|
+
Given test.png file content as request body
|
246
|
+
When I do PUT request http://localhost:3000/images/test.png
|
247
|
+
And I do GET request http://localhost:3000/pictures/test.png?width=123
|
248
|
+
Then response status will be 200
|
249
|
+
And response content type will be image/png
|
250
|
+
Then response body will contain PNG image of size 123x174
|
251
|
+
|
252
|
+
@flexi @size
|
253
|
+
Scenario: Getting custom size tumbnail without width
|
254
|
+
Given test.png file content as request body
|
255
|
+
When I do PUT request http://localhost:3000/images/test.png
|
256
|
+
And I do GET request http://localhost:3000/pictures/test.png?height=321
|
257
|
+
Then response status will be 200
|
258
|
+
And response content type will be image/png
|
259
|
+
Then response body will contain PNG image of size 227x321
|
260
|
+
|
@@ -10,7 +10,7 @@ Feature: Store limited original image in S3 and thumbnail based on request
|
|
10
10
|
"""
|
11
11
|
s3 key="@AWS_ACCESS_KEY_ID@" secret="@AWS_SECRET_ACCESS_KEY@" ssl=false
|
12
12
|
|
13
|
-
path "original-hash" "#{
|
13
|
+
path "original-hash" "#{input_digest}.#{image_mime_extension}"
|
14
14
|
path "path" "#{path}"
|
15
15
|
|
16
16
|
put "original" {
|
@@ -51,6 +51,10 @@ Given /^([^ ]*) file content as request body/ do |file|
|
|
51
51
|
@request_body = File.open(support_dir + file){|f| f.read }
|
52
52
|
end
|
53
53
|
|
54
|
+
Given /there is no file (.*)/ do |file|
|
55
|
+
Pathname.new(file).exist? and Pathname.new(file).unlink
|
56
|
+
end
|
57
|
+
|
54
58
|
Given /S3 settings in AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_S3_TEST_BUCKET environment variables/ do
|
55
59
|
|
56
60
|
unless ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY'] and ENV['AWS_S3_TEST_BUCKET']
|
@@ -78,6 +82,7 @@ Then /S3 bucket will not contain (.*)/ do |key|
|
|
78
82
|
end
|
79
83
|
|
80
84
|
When /I do (.*) request (.*)/ do |method, uri|
|
85
|
+
@request_body = nil if method == 'GET'
|
81
86
|
@response = HTTPClient.new.request(method, URI.encode(uri.replace_s3_variables), nil, @request_body, (@request_headers or {}))
|
82
87
|
end
|
83
88
|
|
@@ -134,6 +139,10 @@ Then /S3 object (.*) will contain (.*) image of size (.*)x(.*)/ do |key, format,
|
|
134
139
|
@image.rows.should == height.to_i
|
135
140
|
end
|
136
141
|
|
142
|
+
Then /S3 object (.*) content type will be (.*)/ do |key, content_type|
|
143
|
+
@bucket.objects[key].content_type.should == content_type
|
144
|
+
end
|
145
|
+
|
137
146
|
Then /response body will contain (.*) image of size (.*)x(.*)/ do |format, width, height|
|
138
147
|
data = @response.body
|
139
148
|
Pathname.new('/tmp/out.jpg').open('w'){|io| io.write data}
|
@@ -146,7 +155,22 @@ Then /response body will contain (.*) image of size (.*)x(.*)/ do |format, width
|
|
146
155
|
@image.rows.should == height.to_i
|
147
156
|
end
|
148
157
|
|
158
|
+
Then /response body will contain UUID/ do
|
159
|
+
@response.body.should ~ /[0-f]{8}-[0-f]{4}-[0-f]{4}-[0-f]{4}-[0-f]{12}/
|
160
|
+
end
|
161
|
+
|
149
162
|
And /that image pixel at (.*)x(.*) should be of color (.*)/ do |x, y, color|
|
150
163
|
@image.pixel_color(x.to_i, y.to_i).to_color.sub(/^#/, '0x').should == color
|
151
164
|
end
|
152
165
|
|
166
|
+
Then /file (.*) will contain (.*) image of size (.*)x(.*)/ do |file, format, width, height|
|
167
|
+
data = Pathname.new(file).read
|
168
|
+
|
169
|
+
@image.destroy! if @image
|
170
|
+
@image = Magick::Image.from_blob(data).first
|
171
|
+
|
172
|
+
@image.format.should == format
|
173
|
+
@image.columns.should == width.to_i
|
174
|
+
@image.rows.should == height.to_i
|
175
|
+
end
|
176
|
+
|
@@ -0,0 +1,199 @@
|
|
1
|
+
Feature: Storing images under different names
|
2
|
+
Storage supports UUID and SHA digest based auto generated storage as well as user provided via request or static configuration string.
|
3
|
+
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given httpthumbnailer server is running at http://localhost:3100/health_check
|
7
|
+
Given httpimagestore server is running at http://localhost:3000/health_check with the following configuration
|
8
|
+
"""
|
9
|
+
path "input_digest" "#{input_digest}"
|
10
|
+
path "input_sha256" "#{input_sha256}"
|
11
|
+
path "image_digest" "#{image_digest}"
|
12
|
+
path "image_sha256" "#{image_sha256}"
|
13
|
+
path "uuid" "#{uuid}"
|
14
|
+
path "image_meta" "#{image_width}x#{image_height}.#{image_mime_extension}"
|
15
|
+
path "input_image_meta" "#{input_image_width}x#{input_image_height}.#{input_image_mime_extension}"
|
16
|
+
|
17
|
+
post "images" "input_digest" {
|
18
|
+
thumbnail "input" "thumbnail" operation="crop" width="50" height="50"
|
19
|
+
store_file "thumbnail" root="/tmp" path="input_digest"
|
20
|
+
output_store_path "thumbnail"
|
21
|
+
}
|
22
|
+
|
23
|
+
post "images" "input_sha256" {
|
24
|
+
thumbnail "input" "thumbnail" operation="crop" width="50" height="50"
|
25
|
+
store_file "thumbnail" root="/tmp" path="input_sha256"
|
26
|
+
output_store_path "thumbnail"
|
27
|
+
}
|
28
|
+
|
29
|
+
post "images" "image_digest" {
|
30
|
+
thumbnail "input" "thumbnail" operation="crop" width="50" height="50"
|
31
|
+
store_file "thumbnail" root="/tmp" path="image_digest"
|
32
|
+
output_store_path "thumbnail"
|
33
|
+
}
|
34
|
+
|
35
|
+
post "images" "image_sha256" {
|
36
|
+
thumbnail "input" "thumbnail" operation="crop" width="50" height="50"
|
37
|
+
store_file "thumbnail" root="/tmp" path="image_sha256"
|
38
|
+
output_store_path "thumbnail"
|
39
|
+
}
|
40
|
+
|
41
|
+
post "images" "uuid" {
|
42
|
+
store_file "input" root="/tmp" path="uuid"
|
43
|
+
output_store_path "input"
|
44
|
+
}
|
45
|
+
|
46
|
+
post "images" "image_meta" "identify" {
|
47
|
+
identify "input"
|
48
|
+
store_file "input" root="/tmp" path="image_meta"
|
49
|
+
output_store_path "input"
|
50
|
+
}
|
51
|
+
|
52
|
+
post "images" "image_meta" "thumbnail" "input" {
|
53
|
+
thumbnail "input" "thumbnail" operation="crop" width="50" height="100"
|
54
|
+
store_file "input" root="/tmp" path="image_meta"
|
55
|
+
output_store_path "input"
|
56
|
+
}
|
57
|
+
|
58
|
+
post "images" "image_meta" "thumbnails" "input" {
|
59
|
+
thumbnail "input" {
|
60
|
+
"thumbnail" operation="crop" width="50" height="100"
|
61
|
+
}
|
62
|
+
|
63
|
+
store_file "input" root="/tmp" path="image_meta"
|
64
|
+
output_store_path "input"
|
65
|
+
}
|
66
|
+
|
67
|
+
post "images" "image_meta" "thumbnail" {
|
68
|
+
thumbnail "input" "thumbnail" operation="crop" width="50" height="100"
|
69
|
+
store_file "thumbnail" root="/tmp" path="image_meta"
|
70
|
+
output_store_path "thumbnail"
|
71
|
+
}
|
72
|
+
|
73
|
+
post "images" "image_meta" "thumbnails" {
|
74
|
+
thumbnail "input" {
|
75
|
+
"thumbnail" operation="crop" width="50" height="100"
|
76
|
+
}
|
77
|
+
store_file "thumbnail" root="/tmp" path="image_meta"
|
78
|
+
output_store_path "thumbnail"
|
79
|
+
}
|
80
|
+
|
81
|
+
post "images" "input_image_meta" "thumbnail" {
|
82
|
+
thumbnail "input" "thumbnail" operation="crop" width="50" height="100"
|
83
|
+
store_file "thumbnail" root="/tmp" path="input_image_meta"
|
84
|
+
output_store_path "thumbnail"
|
85
|
+
}
|
86
|
+
"""
|
87
|
+
|
88
|
+
@storage @input_digest
|
89
|
+
Scenario: Posting picture to file system under input data digest
|
90
|
+
Given there is no file /tmp/b0fe25319ba5909a
|
91
|
+
Given test.png file content as request body
|
92
|
+
When I do POST request http://localhost:3000/images/input_digest
|
93
|
+
Then response status will be 200
|
94
|
+
And response content type will be text/plain
|
95
|
+
And response body will be CRLF ended lines
|
96
|
+
"""
|
97
|
+
b0fe25319ba5909a
|
98
|
+
"""
|
99
|
+
Then file /tmp/b0fe25319ba5909a will contain PNG image of size 50x50
|
100
|
+
|
101
|
+
@storage @input_sha256
|
102
|
+
Scenario: Posting picture to file system under input data digest
|
103
|
+
Given there is no file /tmp/b0fe25319ba5909aa97fded546847a96d7fdf26e18715b0cfccfcbee52dce57e
|
104
|
+
Given test.png file content as request body
|
105
|
+
When I do POST request http://localhost:3000/images/input_sha256
|
106
|
+
Then response status will be 200
|
107
|
+
And response content type will be text/plain
|
108
|
+
And response body will be CRLF ended lines
|
109
|
+
"""
|
110
|
+
b0fe25319ba5909aa97fded546847a96d7fdf26e18715b0cfccfcbee52dce57e
|
111
|
+
"""
|
112
|
+
Then file /tmp/b0fe25319ba5909aa97fded546847a96d7fdf26e18715b0cfccfcbee52dce57e will contain PNG image of size 50x50
|
113
|
+
|
114
|
+
@storage @image_digest
|
115
|
+
Scenario: Posting picture to file system under input data digest
|
116
|
+
Given there is no file /tmp/b0fe25319ba5909a
|
117
|
+
Given test.png file content as request body
|
118
|
+
When I do POST request http://localhost:3000/images/image_digest
|
119
|
+
Then response status will be 200
|
120
|
+
And response content type will be text/plain
|
121
|
+
And response body will be CRLF ended lines
|
122
|
+
"""
|
123
|
+
091000e2c0aee836
|
124
|
+
"""
|
125
|
+
Then file /tmp/091000e2c0aee836 will contain PNG image of size 50x50
|
126
|
+
|
127
|
+
@storage @image_sha256
|
128
|
+
Scenario: Posting picture to file system under input data digest
|
129
|
+
Given there is no file /tmp/b0fe25319ba5909aa97fded546847a96d7fdf26e18715b0cfccfcbee52dce57e
|
130
|
+
Given test.png file content as request body
|
131
|
+
When I do POST request http://localhost:3000/images/image_sha256
|
132
|
+
Then response status will be 200
|
133
|
+
And response content type will be text/plain
|
134
|
+
And response body will be CRLF ended lines
|
135
|
+
"""
|
136
|
+
091000e2c0aee836fff432c1151faba86d46690c900c0f6355247a353defa37f
|
137
|
+
"""
|
138
|
+
Then file /tmp/091000e2c0aee836fff432c1151faba86d46690c900c0f6355247a353defa37f will contain PNG image of size 50x50
|
139
|
+
|
140
|
+
@storage @uuid
|
141
|
+
Scenario: Posting picture to file system under input data digest
|
142
|
+
Given test.png file content as request body
|
143
|
+
When I do POST request http://localhost:3000/images/uuid
|
144
|
+
Then response status will be 200
|
145
|
+
And response content type will be text/plain
|
146
|
+
And response body will contain UUID
|
147
|
+
|
148
|
+
@storage @image_meta @identify
|
149
|
+
Scenario: Posting picture to file system under input data digest
|
150
|
+
Given there is no file /tmp/509x719.png
|
151
|
+
Given test.png file content as request body
|
152
|
+
When I do POST request http://localhost:3000/images/image_meta/identify
|
153
|
+
Then response status will be 200
|
154
|
+
And response content type will be text/plain
|
155
|
+
And response body will be CRLF ended lines
|
156
|
+
"""
|
157
|
+
509x719.png
|
158
|
+
"""
|
159
|
+
Then file /tmp/509x719.png will contain PNG image of size 509x719
|
160
|
+
|
161
|
+
@storage @image_meta @thumbnail
|
162
|
+
Scenario: Posting picture to file system under input data digest
|
163
|
+
Given test.png file content as request body
|
164
|
+
Given there is no file /tmp/50x100.png
|
165
|
+
When I do POST request http://localhost:3000/images/image_meta/thumbnail
|
166
|
+
Then response status will be 200
|
167
|
+
And response content type will be text/plain
|
168
|
+
And response body will be CRLF ended lines
|
169
|
+
"""
|
170
|
+
50x100.png
|
171
|
+
"""
|
172
|
+
Then file /tmp/50x100.png will contain PNG image of size 50x100
|
173
|
+
|
174
|
+
@storage @image_meta @thumbnails
|
175
|
+
Scenario: Posting picture to file system under input data digest
|
176
|
+
Given test.png file content as request body
|
177
|
+
Given there is no file /tmp/50x100.png
|
178
|
+
When I do POST request http://localhost:3000/images/image_meta/thumbnails
|
179
|
+
Then response status will be 200
|
180
|
+
And response content type will be text/plain
|
181
|
+
And response body will be CRLF ended lines
|
182
|
+
"""
|
183
|
+
50x100.png
|
184
|
+
"""
|
185
|
+
Then file /tmp/50x100.png will contain PNG image of size 50x100
|
186
|
+
|
187
|
+
@storage @input_image_meta
|
188
|
+
Scenario: Input image meta variables
|
189
|
+
Given there is no file /tmp/509x719.png
|
190
|
+
Given test.png file content as request body
|
191
|
+
When I do POST request http://localhost:3000/images/input_image_meta/thumbnail
|
192
|
+
Then response status will be 200
|
193
|
+
And response content type will be text/plain
|
194
|
+
And response body will be CRLF ended lines
|
195
|
+
"""
|
196
|
+
509x719.png
|
197
|
+
"""
|
198
|
+
Then file /tmp/509x719.png will contain PNG image of size 50x100
|
199
|
+
|
Binary file
|
Binary file
|
data/httpimagestore.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "httpimagestore"
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jakub Pastuszek"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-09-11"
|
13
13
|
s.description = "Thumbnails images using httpthumbnailer and stored data on HTTP server (S3)"
|
14
14
|
s.email = "jpastuszek@gmail.com"
|
15
15
|
s.executables = ["httpimagestore"]
|
@@ -30,20 +30,23 @@ Gem::Specification.new do |s|
|
|
30
30
|
"features/cache-control.feature",
|
31
31
|
"features/compatibility.feature",
|
32
32
|
"features/error-reporting.feature",
|
33
|
-
"features/
|
33
|
+
"features/flexi.feature",
|
34
34
|
"features/health-check.feature",
|
35
35
|
"features/s3-store-and-thumbnail.feature",
|
36
36
|
"features/step_definitions/httpimagestore_steps.rb",
|
37
|
+
"features/storage.feature",
|
37
38
|
"features/support/env.rb",
|
38
39
|
"features/support/test-large.jpg",
|
39
40
|
"features/support/test.empty",
|
40
41
|
"features/support/test.jpg",
|
42
|
+
"features/support/test.png",
|
41
43
|
"features/support/test.txt",
|
42
44
|
"httpimagestore.gemspec",
|
43
45
|
"lib/httpimagestore/aws_sdk_regions_hack.rb",
|
44
46
|
"lib/httpimagestore/configuration.rb",
|
45
47
|
"lib/httpimagestore/configuration/file.rb",
|
46
48
|
"lib/httpimagestore/configuration/handler.rb",
|
49
|
+
"lib/httpimagestore/configuration/identify.rb",
|
47
50
|
"lib/httpimagestore/configuration/output.rb",
|
48
51
|
"lib/httpimagestore/configuration/path.rb",
|
49
52
|
"lib/httpimagestore/configuration/s3.rb",
|
@@ -56,6 +59,7 @@ Gem::Specification.new do |s|
|
|
56
59
|
"load_test/thumbnail_specs.csv",
|
57
60
|
"spec/configuration_file_spec.rb",
|
58
61
|
"spec/configuration_handler_spec.rb",
|
62
|
+
"spec/configuration_identify_spec.rb",
|
59
63
|
"spec/configuration_output_spec.rb",
|
60
64
|
"spec/configuration_path_spec.rb",
|
61
65
|
"spec/configuration_s3_spec.rb",
|
@@ -77,8 +81,8 @@ Gem::Specification.new do |s|
|
|
77
81
|
s.specification_version = 3
|
78
82
|
|
79
83
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
80
|
-
s.add_runtime_dependency(%q<unicorn-cuba-base>, ["~> 1.
|
81
|
-
s.add_runtime_dependency(%q<httpthumbnailer-client>, ["~> 1.
|
84
|
+
s.add_runtime_dependency(%q<unicorn-cuba-base>, ["~> 1.1"])
|
85
|
+
s.add_runtime_dependency(%q<httpthumbnailer-client>, ["~> 1.1"])
|
82
86
|
s.add_runtime_dependency(%q<aws-sdk>, ["~> 1.10"])
|
83
87
|
s.add_runtime_dependency(%q<mime-types>, ["~> 1.17"])
|
84
88
|
s.add_runtime_dependency(%q<sdl4r>, ["~> 0.9"])
|
@@ -91,8 +95,8 @@ Gem::Specification.new do |s|
|
|
91
95
|
s.add_development_dependency(%q<prawn>, ["= 0.8.4"])
|
92
96
|
s.add_development_dependency(%q<httpthumbnailer>, [">= 0"])
|
93
97
|
else
|
94
|
-
s.add_dependency(%q<unicorn-cuba-base>, ["~> 1.
|
95
|
-
s.add_dependency(%q<httpthumbnailer-client>, ["~> 1.
|
98
|
+
s.add_dependency(%q<unicorn-cuba-base>, ["~> 1.1"])
|
99
|
+
s.add_dependency(%q<httpthumbnailer-client>, ["~> 1.1"])
|
96
100
|
s.add_dependency(%q<aws-sdk>, ["~> 1.10"])
|
97
101
|
s.add_dependency(%q<mime-types>, ["~> 1.17"])
|
98
102
|
s.add_dependency(%q<sdl4r>, ["~> 0.9"])
|
@@ -106,8 +110,8 @@ Gem::Specification.new do |s|
|
|
106
110
|
s.add_dependency(%q<httpthumbnailer>, [">= 0"])
|
107
111
|
end
|
108
112
|
else
|
109
|
-
s.add_dependency(%q<unicorn-cuba-base>, ["~> 1.
|
110
|
-
s.add_dependency(%q<httpthumbnailer-client>, ["~> 1.
|
113
|
+
s.add_dependency(%q<unicorn-cuba-base>, ["~> 1.1"])
|
114
|
+
s.add_dependency(%q<httpthumbnailer-client>, ["~> 1.1"])
|
111
115
|
s.add_dependency(%q<aws-sdk>, ["~> 1.10"])
|
112
116
|
s.add_dependency(%q<mime-types>, ["~> 1.17"])
|
113
117
|
s.add_dependency(%q<sdl4r>, ["~> 0.9"])
|