easyimg_utils 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/easyimg_utils.rb +19 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 491f7066a8af2e40049a6986c894498d507d99b2b02caf4321f59abb25a05dd1
|
4
|
+
data.tar.gz: e6d42410ed62a4a0829c648b5622b28845930fa18853202e6ac507d0e7e34186
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57a595c6b1b171e44600bcdd043a36f90ce89453fc5d57e40fd8016a5f6518be8753c247bd613b2e5318ee6db05ababb9735a0c47b928775b96a4ef5bd99dac0
|
7
|
+
data.tar.gz: aa6f56c7307732c2f4f93f2298d32d0e2de8d164a2cee099f5ebdc18e433bccb162e43c5b3bd2e4ad9d2c87d0398c131531d10dcceb8099bbce4873d19d5fd19
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/easyimg_utils.rb
CHANGED
@@ -94,20 +94,35 @@ class EasyImgUtils
|
|
94
94
|
|
95
95
|
# e.g. calc_resize '1449x1932', '640x480' #=> 480x640
|
96
96
|
# e.g. calc_resize '518x1024', '*518x500' #=> "518x1024"
|
97
|
-
# the asterisk denotes a
|
97
|
+
# the asterisk denotes a guarantee the image will be resized to a
|
98
|
+
# minimum size on either dimension
|
98
99
|
#
|
99
|
-
|
100
|
+
# e.g. calc_resize '1920x1088', '*518x*500' #=> "882x500"
|
101
|
+
# 2 asterisks denotes a guaranteed minumum size on both dimensions
|
102
|
+
#
|
103
|
+
def self.calc_resize(geometry, new_geometry)
|
100
104
|
|
101
105
|
xy = geometry.split('x',2)
|
102
106
|
xy2 = new_geometry.split('x',2)
|
103
107
|
|
104
108
|
# find any locked geometry which guarantees the resize on either x or y
|
105
|
-
|
109
|
+
locks = xy2.select {|x| x =~ /^\*/}
|
106
110
|
|
107
111
|
a = xy.map {|x| x[/\d+/].to_i}
|
108
112
|
a2 = xy2.map {|x| x[/\d+/].to_i}
|
113
|
+
|
114
|
+
i = if locks.length > 1 then
|
109
115
|
|
110
|
-
|
116
|
+
a.index(a.min)
|
117
|
+
|
118
|
+
elsif locks.any?
|
119
|
+
|
120
|
+
lock = locks.first
|
121
|
+
a2.index(lock[1..-1].to_i)
|
122
|
+
|
123
|
+
else
|
124
|
+
a.index(a.max)
|
125
|
+
end
|
111
126
|
|
112
127
|
factor = a2[i] / a[i].to_f
|
113
128
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easyimg_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
KY48n99T12IOioQ4ghCO1L/UAg2taLOcZbMv4WpV1p9bXKhnrow81zeogZjjiNGS
|
36
36
|
OmTAjCfyGFPC/1eXnSV5Smv8
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-03-
|
38
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rmagick
|
metadata.gz.sig
CHANGED
Binary file
|