image_vise 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/SECURITY.md +6 -6
- data/image_vise.gemspec +4 -3
- data/lib/image_vise/render_engine.rb +9 -3
- data/lib/image_vise.rb +1 -1
- data/spec/image_vise/render_engine_spec.rb +21 -0
- data/spec/layers-with-blending.psd +0 -0
- data/spec/spec_helper.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 493e78593a4399614a6db7dc12b6718941e4de04
|
4
|
+
data.tar.gz: 31e96d402674418e02c1a3bc9a88810889af16c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a14f2987b638ec2cead4ac87e269ad131fd1d1409834b5b0b0efddbd464a3e434e6a24bad127249b6173ccd655e2957fc23d48b4f5490564e4833c93dbb2181
|
7
|
+
data.tar.gz: 67d3fc0181b7935f24c9a48afb5ff90afc813e6abc5fc2e627c41c0c51f0f4dc45326ec300fab03114647d98e8950ca64f42ac3a4bf4b5640c6c127621030c9b
|
data/SECURITY.md
CHANGED
@@ -10,12 +10,12 @@ For checking HMAC values `Rack::Utils.secure_compare` constant-time comparison i
|
|
10
10
|
|
11
11
|
## Cache bypass protection for randomized query string params
|
12
12
|
|
13
|
-
ImageVise
|
14
|
-
|
15
|
-
|
13
|
+
ImageVise defaults to using paths. If you have a way to forbid query strings on the fronting CDN
|
14
|
+
or proxy server we suggest you to do so, to prevent randomized URLs from filling up your cache
|
15
|
+
and extreme amounts of processing from happening.
|
16
16
|
|
17
|
-
* `/
|
18
|
-
* `/
|
17
|
+
* `/image/<pipeline>/<sig>?&random=123`
|
18
|
+
* `/image/<pipeline>/<sig>?&random=456`
|
19
19
|
|
20
20
|
These URLs would in fact resolve to the same source image and pipeline, but would not be stored in an upstream
|
21
21
|
CDN cache because the query string params contain extra data.
|
@@ -41,4 +41,4 @@ ImageVise does not set RMagick limits by itself. You should
|
|
41
41
|
## Processing time constraints
|
42
42
|
|
43
43
|
If you are using forking, there will be a timeout used for how long the forked child process may run,
|
44
|
-
which is the default timeout used in ExceptionalFork.
|
44
|
+
which is the default timeout used in ExceptionalFork.
|
data/image_vise.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: image_vise 0.1.
|
5
|
+
# stub: image_vise 0.1.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "image_vise"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Julik Tarkhanov"]
|
14
|
-
s.date = "2016-10-
|
14
|
+
s.date = "2016-10-26"
|
15
15
|
s.description = "Image processing via URLs"
|
16
16
|
s.email = "me@julik.nl"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -61,6 +61,7 @@ Gem::Specification.new do |s|
|
|
61
61
|
"spec/image_vise/srgb_spec.rb",
|
62
62
|
"spec/image_vise/strip_metadata_spec.rb",
|
63
63
|
"spec/image_vise_spec.rb",
|
64
|
+
"spec/layers-with-blending.psd",
|
64
65
|
"spec/spec_helper.rb",
|
65
66
|
"spec/test_server.rb",
|
66
67
|
"spec/waterside_magic_hour.jpg",
|
@@ -289,9 +289,14 @@ class ImageVise::RenderEngine
|
|
289
289
|
# @return [void]
|
290
290
|
def apply_pipeline(source_file_path, pipeline, source_file_type, render_to_path)
|
291
291
|
render_file_type = source_file_type
|
292
|
-
magick_image = Magick::Image.read(source_file_path)[0]
|
293
|
-
pipeline.apply!(magick_image)
|
294
292
|
|
293
|
+
# Load the first frame of the animated GIF _or_ the blended compatibility layer from Photoshop
|
294
|
+
image_list = Magick::Image.read(source_file_path)
|
295
|
+
magick_image = image_list.first
|
296
|
+
|
297
|
+
# Apply the pipeline
|
298
|
+
pipeline.apply!(magick_image)
|
299
|
+
|
295
300
|
# If processing the image has created an alpha channel, use PNG always.
|
296
301
|
# Otherwise, keep the original format for as far as the supported formats list goes.
|
297
302
|
render_file_type = PNG_FILE_TYPE if magick_image.alpha?
|
@@ -300,7 +305,8 @@ class ImageVise::RenderEngine
|
|
300
305
|
magick_image.format = render_file_type.ext
|
301
306
|
magick_image.write(render_to_path)
|
302
307
|
ensure
|
303
|
-
|
308
|
+
# destroy all the loaded images explicitly
|
309
|
+
(image_list || []).map {|img| ImageVise.destroy(img) }
|
304
310
|
end
|
305
311
|
|
306
312
|
end
|
data/lib/image_vise.rb
CHANGED
@@ -264,6 +264,27 @@ describe ImageVise::RenderEngine do
|
|
264
264
|
expect(last_response.headers['Content-Type']).to eq('image/png')
|
265
265
|
end
|
266
266
|
|
267
|
+
it 'destroys all the loaded PSD layers' do
|
268
|
+
uri = Addressable::URI.parse(public_url_psd_multilayer)
|
269
|
+
ImageVise.add_allowed_host!(uri.host)
|
270
|
+
ImageVise.add_secret_key!('l33tness')
|
271
|
+
|
272
|
+
p = ImageVise::Pipeline.new.geom(geometry_string: '220x220')
|
273
|
+
image_request = ImageVise::ImageRequest.new(src_url: uri.to_s, pipeline: p)
|
274
|
+
|
275
|
+
class << app
|
276
|
+
def source_file_type_permitted?(type); true; end
|
277
|
+
def raise_exceptions?; true; end
|
278
|
+
end
|
279
|
+
|
280
|
+
# For each layer loaded into the ImageList
|
281
|
+
expect(ImageVise).to receive(:destroy).and_call_original.exactly(5).times
|
282
|
+
|
283
|
+
get image_request.to_path_params('l33tness')
|
284
|
+
|
285
|
+
expect(last_response.status).to eq(200)
|
286
|
+
end
|
287
|
+
|
267
288
|
it 'outputs a converted TIFF file as a PNG' do
|
268
289
|
uri = Addressable::URI.parse(public_url_tif)
|
269
290
|
ImageVise.add_allowed_host!(uri.host)
|
Binary file
|
data/spec/spec_helper.rb
CHANGED
@@ -84,6 +84,10 @@ RSpec.configure do | config |
|
|
84
84
|
'http://localhost:9001/waterside_magic_hour.psd'
|
85
85
|
end
|
86
86
|
|
87
|
+
def public_url_psd_multilayer
|
88
|
+
'http://localhost:9001/layers-with-blending.psd'
|
89
|
+
end
|
90
|
+
|
87
91
|
def public_url_tif
|
88
92
|
'http://localhost:9001/waterside_magic_hour_gray.tif'
|
89
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_vise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: patron
|
@@ -304,6 +304,7 @@ files:
|
|
304
304
|
- spec/image_vise/srgb_spec.rb
|
305
305
|
- spec/image_vise/strip_metadata_spec.rb
|
306
306
|
- spec/image_vise_spec.rb
|
307
|
+
- spec/layers-with-blending.psd
|
307
308
|
- spec/spec_helper.rb
|
308
309
|
- spec/test_server.rb
|
309
310
|
- spec/waterside_magic_hour.jpg
|