easyimg_utils 0.6.4 → 0.6.5
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/easyimg_utils.rb +13 -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: 931f6444de27b1df65cfe7e9f4b3c296e2f826f42cdb58f5bb6dc2c5f597e284
|
4
|
+
data.tar.gz: 119ef63fee91fd0ac7fc8402b6be7ff362a65b567279819c739449730af5d0d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18e8ec2efe4c0c7f0c0ada668f78bc5952c90b44ae7b85d9c10f121375f5752f8ddfe74709e5fdc8ff516dddd43325c084241048cd7c36d904fdae0b613fec79
|
7
|
+
data.tar.gz: f4e5176eb71d1aaf6e3898ec68fd823568ea4d73bcf51cf3ce176ff57f0c71ecf9678e719f1cb422ebcd0eb47663c4a005060c82c2eee4d50ec9f976ef48abed
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/easyimg_utils.rb
CHANGED
@@ -88,12 +88,21 @@ class EasyImgUtils
|
|
88
88
|
end
|
89
89
|
|
90
90
|
# e.g. calc_resize '1449x1932', '640x480' #=> 480x640
|
91
|
+
# e.g. calc_resize '518x1024', '*518x500' #=> "518x1024"
|
92
|
+
# the asterisk denotes a guaranteed the image will be resized using x or y
|
91
93
|
#
|
92
|
-
def self.calc_resize(
|
94
|
+
def self.calc_resize(geometry, new_geometry, force: false)
|
93
95
|
|
94
|
-
|
95
|
-
|
96
|
-
|
96
|
+
xy = geometry.split('x',2)
|
97
|
+
xy2 = new_geometry.split('x',2)
|
98
|
+
|
99
|
+
# find any locked geometry which guarantees the resize on either x or y
|
100
|
+
lock = xy2.find {|x| x =~ /^\*/}
|
101
|
+
|
102
|
+
a = xy.map {|x| x[/\d+/].to_i}
|
103
|
+
a2 = xy2.map {|x| x[/\d+/].to_i}
|
104
|
+
|
105
|
+
i = lock ? a2.index(lock[1..-1].to_i) : a.index(a.max)
|
97
106
|
|
98
107
|
factor = a2[i] / a[i].to_f
|
99
108
|
|
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.6.
|
4
|
+
version: 0.6.5
|
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-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rmagick
|
metadata.gz.sig
CHANGED
Binary file
|