infopark_fiona7 1.5.5.4.0 → 1.5.5.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e1b268827386ff36463ab06a15afdee261a1273
4
- data.tar.gz: edfd0fb11950038b68c440457f7d7a20a5c2afce
3
+ metadata.gz: 680cc8e643912cbbf98dc96eb8efd1d66cec19a3
4
+ data.tar.gz: d56bd4c52dad56d36e435679a40a5826198ebb75
5
5
  SHA512:
6
- metadata.gz: cf9a981a212c5a2527986e4f6d298d000b243fc883ecc017208fc9e378df22e89de7784aa97c56e65942fbd09cf8d1390bb0601ee90678e7fe7d44dde7d5903c
7
- data.tar.gz: bf3d33be89c1d3afafc7b28a5992ff29e5c5a7ff637640615ab522697a8415458082095a11fd35c6a507fd572b347bd923402d39604005f0ce7fba40c4850e68
6
+ metadata.gz: 219685c11a611e89cdd60c49643b57050b06c8d3aedaa5903b4766fa0b555440d8ecf4fec0ce58b62c1d206859d6541e6a2d47db646f556100f18e3a21ff22e7
7
+ data.tar.gz: a9a75d826d516430bd09e4dae365bc8221c77cdd48141797ac53b61fad6a707af19fecfc17981489ceaf2865d60a23ab4b0d7c5d2674dac7cf2c83ff20447f50
@@ -150,7 +150,7 @@ module Fiona7
150
150
  (!self.height.present? || (1..4096).include?(self.height.to_i)) &&
151
151
  ((0..100).include?(self.quality.to_i)) &&
152
152
  (!self.fit.present? || (
153
- (self.fit == 'clip' || self.fit == 'crop') &&
153
+ (self.fit == 'clip' || self.fit == 'crop' || self.fit == 'resize') &&
154
154
  (self.width.to_i + self.height.to_i < 4096) &&
155
155
  (self.fit == 'clip' || (self.width.present? && self.height.present?))
156
156
  ))
@@ -171,16 +171,18 @@ module Fiona7
171
171
 
172
172
  image = MiniMagick::Image.open(original_filepath)
173
173
 
174
- if self.fit.blank?
174
+ fit = self.fit_with_default
175
+
176
+ if fit.blank?
175
177
  image.combine_options do |b|
176
178
  b.quality self.quality.to_i
177
179
  end
178
- elsif self.fit == 'clip'
180
+ elsif fit == 'clip' || fit == 'resize'
179
181
  image.combine_options do |b|
180
182
  b.resize "#{self.width}x#{self.height}>"
181
183
  b.quality self.quality.to_i
182
184
  end
183
- elsif self.fit == 'crop'
185
+ elsif fit == 'crop'
184
186
  image.combine_options do |b|
185
187
  b.resize "#{self.width}x#{self.height}^"
186
188
  b.gravity self.gravity
@@ -236,6 +238,10 @@ module Fiona7
236
238
  def fit
237
239
  self.transformation_with_fallback[:fit]
238
240
  end
241
+
242
+ def fit_with_default
243
+ self.fit || ((width.present? || height.present?) && 'resize') || nil
244
+ end
239
245
  end
240
246
 
241
247
  delegate :valid?, :present?,
@@ -352,7 +358,7 @@ module Fiona7
352
358
  def transformation_from_params
353
359
  if self.request.query_string
354
360
  ParamEncoder.new.decode(
355
- ::CGI.parse(self.request.query_string)["t"]
361
+ ::CGI.parse(self.request.query_string)["t"].try(:first)
356
362
  )
357
363
  end
358
364
  end
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "1.5.5.4.0"
2
+ VERSION = "1.5.5.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona7
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5.4.0
4
+ version: 1.5.5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-16 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails