image_quality_check 0.3.0 → 0.4.0

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: a810f6dcf2ceadf8e6304d9f8541f940f09372dccf6e030e545d568cf8958fd5
4
- data.tar.gz: 96fa32d7aee06e29793a458adf07ccacea40e522772aac775ebd088b31a15a15
3
+ metadata.gz: 2c34b97bb325493a6e00fa5edfbab4e0187230f3ce9271681d16085f3da4ecb3
4
+ data.tar.gz: 4cdab0adfd1efab3a287a1f45649abe2e3303f00dd661665ef13747eea2d743e
5
5
  SHA512:
6
- metadata.gz: 16bf50f9ba0f0da20af8941714ea6ff96aa6369786a54669bd29197d5f9f36b08df1ee0af2c7fc3605e3c03afc51aae5d25f42620ce7ed1ebeb138f52993b668
7
- data.tar.gz: ece0ea9ec666d0917faba163245e340ca34d5e78ac560fb2c23ce14162ccbc99ba6b4fa45ed438be96142e46f25ea8b9b4a134473127127e7d900366ddcb3d3a
6
+ metadata.gz: 0eb0945139a77528a4910ff499ffbea9b1a63c996078ed9b740dd31ddf5b5c67094a10f348ee96574e86b3b83bdf1a3142b9fca86c6dc5fb4ee653454a8780cc
7
+ data.tar.gz: fcde5e2077d891ae333ff397ad561cbd0cd7df639670bb9ee541a7564eab05b40d625526235747bdab2b232dad705e12c6eb5de82d5791ee85dc29bab82238e5
@@ -70,7 +70,10 @@ class ImageQualityCheck::DetermineQuality
70
70
  true
71
71
  end
72
72
  when "Paperclip::Attachment"
73
- if !@column.path || !File.exist?(@column.path)
73
+ if @column.options[:storage] == :s3
74
+ @column.copy_to_local_file(:original, tmp_file.path)
75
+ true
76
+ elsif !@column.path || !File.exist?(@column.path)
74
77
  false
75
78
  else
76
79
  FileUtils.cp(@column.path, tmp_file.path)
@@ -1,3 +1,3 @@
1
1
  module ImageQualityCheck
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -14,12 +14,18 @@ module ImageQualityCheck
14
14
 
15
15
  def self.analyze(path_to_image)
16
16
  out = `convert #{Shellwords.escape path_to_image} json:`
17
- # image magick gif delay bug invalid json
18
- # https://github.com/ImageMagick/ImageMagick/issues/1624
19
- out.gsub!(/("delay": "[^"]+")\n/m, "\\1,\n")
20
17
  return {} if out.empty?
21
18
 
22
- raw_json = JSON.parse(out)
19
+ raw_json = nil
20
+ begin
21
+ raw_json = JSON.parse(out)
22
+ rescue StandardError
23
+ # image magick gif delay bug invalid json
24
+ # https://github.com/ImageMagick/ImageMagick/issues/1624
25
+ out.gsub!(/("delay": "[^"]+")\n/m, "\\1,\n")
26
+ end
27
+
28
+ raw_json ||= JSON.parse(out)
23
29
  json = raw_json.is_a?(Array) ? raw_json.first['image'] : raw_json['image']
24
30
  background_is_transparent =
25
31
  json.dig('channelDepth', 'alpha') &&
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_quality_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-17 00:00:00.000000000 Z
11
+ date: 2025-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n