image_quality_check 0.4.1 → 0.5.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 +4 -4
- data/lib/image_quality_check/determine_quality.rb +22 -17
- data/lib/image_quality_check/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d9e3e782cc7e109a7b147f4aa88363ba220fe01dde01093bfcd0a363c8e963b3
|
|
4
|
+
data.tar.gz: 0a73b6c510b7ac5601a8774ad12278a93baca8da59ce52ed98e12bf296db0c72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed4b6d4b297327b7bd4adf0b005b123e03a567b109a7e7ebb9bbb97e2243baf9f9a97b826a036fe6bd1fcc892a08a5b690b2a3c1a2cf5b2a272c176c9d1a0daf
|
|
7
|
+
data.tar.gz: 8d3b334b6f4d205e06ab86d889b5698dc3d4e72cc3b4916242c20e49ec8574e692af0b9b7a51066b2752fe3eef303a84b19ffc3cdc0598c873dbcf0d38dcd2e5
|
|
@@ -13,10 +13,10 @@ class ImageQualityCheck::DetermineQuality
|
|
|
13
13
|
@tmp_file = tmp_file
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def run
|
|
16
|
+
def run
|
|
17
17
|
unless @tmp_file
|
|
18
18
|
@tmp_file = Tempfile.new(['image_quality'])
|
|
19
|
-
@tmp_file.
|
|
19
|
+
@tmp_file.binmode
|
|
20
20
|
unless read!(@tmp_file)
|
|
21
21
|
result = {
|
|
22
22
|
quality: 0,
|
|
@@ -32,7 +32,7 @@ class ImageQualityCheck::DetermineQuality
|
|
|
32
32
|
result = {
|
|
33
33
|
quality: determine_quality,
|
|
34
34
|
details: @analyse_result,
|
|
35
|
-
messages: @messages
|
|
35
|
+
messages: @messages
|
|
36
36
|
}
|
|
37
37
|
yield(result) if block_given?
|
|
38
38
|
result
|
|
@@ -64,23 +64,28 @@ class ImageQualityCheck::DetermineQuality
|
|
|
64
64
|
def read!(tmp_file)
|
|
65
65
|
case @column.class.to_s
|
|
66
66
|
when 'ActiveStorage::Attached::One'
|
|
67
|
+
return false if !@column.blob || !@column.attached?
|
|
68
|
+
|
|
69
|
+
copied_from_disk = false
|
|
67
70
|
if @column.blob.service.respond_to?(:path_for)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
else
|
|
78
|
-
tmp_file.write(@column.download)
|
|
79
|
-
tmp_file.rewind
|
|
80
|
-
true
|
|
71
|
+
begin
|
|
72
|
+
path = @column.blob.service.send(:path_for, @column.blob.key)
|
|
73
|
+
if File.exist?(path)
|
|
74
|
+
FileUtils.cp(path, tmp_file.path)
|
|
75
|
+
copied_from_disk = true
|
|
76
|
+
end
|
|
77
|
+
rescue NoMethodError
|
|
78
|
+
# MirrorService responds to :path_for but may delegate to a service
|
|
79
|
+
# that doesn't support it (e.g. S3Service)
|
|
81
80
|
end
|
|
82
81
|
end
|
|
83
|
-
|
|
82
|
+
|
|
83
|
+
unless copied_from_disk
|
|
84
|
+
tmp_file.write(@column.download)
|
|
85
|
+
tmp_file.rewind
|
|
86
|
+
end
|
|
87
|
+
true
|
|
88
|
+
when 'Paperclip::Attachment'
|
|
84
89
|
if @column.options[:storage] == :s3
|
|
85
90
|
@column.copy_to_local_file(:original, tmp_file.path)
|
|
86
91
|
true
|
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.
|
|
4
|
+
version: 0.5.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:
|
|
11
|
+
date: 2026-03-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: i18n
|