voltron-crop 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa0b2ed35e7274922caf416da52fb672edcb9714a9e7bb990abf15e91f59070f
4
- data.tar.gz: 01e44206dbf45b0e28e5e917c5f71e3b7067845a0a01742bdce061892187651c
3
+ metadata.gz: 31631f0edc1524ac4b00a1b3bc635e4c60a61a172a0cf404221eadad12b43344
4
+ data.tar.gz: 6c1e3a70d7c730eca50ca8db70254503f3a2df23af89494398ea4293d963b53d
5
5
  SHA512:
6
- metadata.gz: edfc87008365ed1b36a29e45c307c467b56c249e28b2ddadc346a3af88b3a0d3e17f9e1b59fb7b1296e3f8fa77326a2d2b377c7132487389ff73225511cd3441
7
- data.tar.gz: 8b0b1d73756f34754f6273fa473e36322dbf3fa326595955b833ba3c974d301d466131a15c1e75820102e2a6b1c8ac53474e8aea3276997e3f2e35f224172933
6
+ metadata.gz: 33093d022e540e7fdff6fc631072e79bc8899b2c9aecb4ba01addfcf57d6fbeba9deecb99006e7705b5a8a5646928e1d07fe950cd9ab60aa78b54c82a071edd3
7
+ data.tar.gz: 773ba11969834a8afee2fbb4a1338e3cf6e93caaf171ba665eeace877c56c2c4e313523df325fa48dcc88efc6ca003eb166f5129d12bda14acb5b9a61c480177
@@ -24,7 +24,7 @@ module Voltron
24
24
  coordinates = [send("#{column}_x"), send("#{column}_y")].join('+')
25
25
 
26
26
  # Crop the image, scale up if it's smaller than the required crop size
27
- img = ::MiniMagick::Image.new(upload.path)
27
+ img = upload.url.starts_with?('http') ? ::MiniMagick::Image.open(upload.url) : ::MiniMagick::Image.open(upload.path)
28
28
  img.crop("#{dimensions}+#{coordinates}")
29
29
  if img.width < Voltron.config.crop.min_width || img.height < Voltron.config.crop.min_height
30
30
  img.resize "#{Voltron.config.crop.min_width}x#{Voltron.config.crop.min_height}"
@@ -36,7 +36,7 @@ module Voltron
36
36
 
37
37
  file = ActionDispatch::Http::UploadedFile.new({
38
38
  type: upload.content_type,
39
- filename: upload.file.original_filename,
39
+ filename: upload.file.filename,
40
40
  head: "Content-Disposition: form-data; name=\"#{input_name}\"; filename=\"#{upload.filename}\"\r\nContent-Type: #{upload.content_type}\r\n",
41
41
  tempfile: to
42
42
  })
@@ -1,5 +1,5 @@
1
1
  module Voltron
2
2
  module Crop
3
- VERSION = '0.1.3'.freeze
3
+ VERSION = '0.1.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voltron-crop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hainer