dragonfly_libvips 2.0.0 → 2.0.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/dragonfly_libvips.gemspec +1 -1
- data/lib/dragonfly_libvips/analysers/image_properties.rb +13 -5
- data/lib/dragonfly_libvips/processors/encode.rb +3 -0
- data/lib/dragonfly_libvips/processors/rotate.rb +3 -0
- data/lib/dragonfly_libvips/processors/thumb.rb +5 -2
- data/lib/dragonfly_libvips/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 835350b6d18b031b00f0071279b84694ef940e58
|
4
|
+
data.tar.gz: b306a0a01d08232767091e703772360526030795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c54e214ddf782d3dbc3d09877de7f679c94c54df30ea510eb4b07bec5d02fcffa5481f34b987f79359f80a74c2de92b4abc09dc6c704fe71a3a2c38a54ddcde
|
7
|
+
data.tar.gz: a0955d32cfd0e2d0eee0e1ec66e1dafab85bed3f963d06b2572f6ee5a8f13d9347bf26d09badff09ec6d5918a34545a4caa2556b7e9f1c5881178c2e08bfe248
|
data/CHANGELOG.md
CHANGED
data/dragonfly_libvips.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'dragonfly', '~> 1.0'
|
22
|
-
spec.add_dependency 'ruby-vips', '~> 2.0'
|
22
|
+
spec.add_dependency 'ruby-vips', '~> 2.0', '>= 2.0.1'
|
23
23
|
spec.add_dependency 'activesupport', '>= 4.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.12'
|
@@ -3,14 +3,22 @@ module DragonflyLibvips
|
|
3
3
|
class ImageProperties
|
4
4
|
def call(content)
|
5
5
|
require 'vips'
|
6
|
-
|
6
|
+
|
7
|
+
input_options = {}
|
8
|
+
input_options[:access] = :sequential
|
9
|
+
input_options[:autorotate] = true if content.mime_type == 'image/jpeg'
|
10
|
+
|
11
|
+
img = ::Vips::Image.new_from_file(content.path, input_options)
|
12
|
+
|
13
|
+
width, height = img.width, img.height
|
14
|
+
xres, yres = img.xres, img.yres
|
7
15
|
|
8
16
|
{
|
9
17
|
'format' => content.ext,
|
10
|
-
'width' =>
|
11
|
-
'height' =>
|
12
|
-
'xres' =>
|
13
|
-
'yres' =>
|
18
|
+
'width' => width,
|
19
|
+
'height' => height,
|
20
|
+
'xres' => xres,
|
21
|
+
'yres' => yres
|
14
22
|
}
|
15
23
|
end
|
16
24
|
end
|
@@ -10,6 +10,9 @@ module DragonflyLibvips
|
|
10
10
|
output_options = options.fetch('output_options', {})
|
11
11
|
|
12
12
|
input_options['access'] ||= 'sequential'
|
13
|
+
if content.mime_type == 'image/jpeg'
|
14
|
+
input_options['autorotate'] = true unless input_options.has_key?('autorotate')
|
15
|
+
end
|
13
16
|
output_options['profile'] ||= DragonflyLibvips::EPROFILE_PATH
|
14
17
|
|
15
18
|
require 'vips'
|
@@ -12,6 +12,9 @@ module DragonflyLibvips
|
|
12
12
|
output_options = options.fetch('output_options', {})
|
13
13
|
|
14
14
|
input_options['access'] ||= 'sequential'
|
15
|
+
if content.mime_type == 'image/jpeg'
|
16
|
+
input_options['autorotate'] = true unless input_options.has_key?('autorotate')
|
17
|
+
end
|
15
18
|
output_options['profile'] ||= DragonflyLibvips::EPROFILE_PATH
|
16
19
|
|
17
20
|
require 'vips'
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support/core_ext/hash'
|
2
2
|
require 'dragonfly_libvips/dimensions'
|
3
|
+
require 'vips'
|
3
4
|
|
4
5
|
module DragonflyLibvips
|
5
6
|
module Processors
|
@@ -18,13 +19,15 @@ module DragonflyLibvips
|
|
18
19
|
output_options = options.fetch('output_options', {})
|
19
20
|
|
20
21
|
input_options['access'] ||= 'sequential'
|
22
|
+
if content.mime_type == 'image/jpeg'
|
23
|
+
input_options['autorotate'] = true unless input_options.has_key?('autorotate')
|
24
|
+
end
|
21
25
|
output_options['profile'] ||= DragonflyLibvips::EPROFILE_PATH
|
22
26
|
|
23
|
-
require 'vips'
|
24
27
|
img = ::Vips::Image.new_from_file(content.path, input_options)
|
25
28
|
|
26
29
|
dimensions = case geometry
|
27
|
-
|
30
|
+
when RESIZE_GEOMETRY then DragonflyLibvips::Dimensions.call(geometry, img.width, img.height)
|
28
31
|
else raise ArgumentError, "Didn't recognise the geometry string #{geometry}"
|
29
32
|
end
|
30
33
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly_libvips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dragonfly
|
@@ -31,6 +31,9 @@ dependencies:
|
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.0.1
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,6 +41,9 @@ dependencies:
|
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '2.0'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.0.1
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: activesupport
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|