active_storage-blurhash 0.1.2 → 0.1.3
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/README.md +4 -0
- data/lib/active_storage/blurhash/thumbnail/vips.rb +12 -1
- data/lib/active_storage/blurhash/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: b096baa6115a2a2ca17db621b34f2a9befd1a99cce742870a5926925f21fd0ee
|
|
4
|
+
data.tar.gz: 0f29145747785a95ffaf9aa42a76a6885c5e2c568b604c6a57b5875f7097d30a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ba322c3b66974efed5633970241a18da9bdf52bf6d2db4b3323659700f1123be6d865053ad6c02ad9b1c779da9bddfb40ef30ad709f461d82a68e4edd557742
|
|
7
|
+
data.tar.gz: c00af72bf91b7d00d9ee0010a41a9fa27da535bf1a92b39c59d934dfa9757367e97310f096a8fe161e9428ca4cd762a8ab5ba6ff5ec937e96e5d2ec0115c0655
|
data/README.md
CHANGED
|
@@ -75,6 +75,10 @@ Note that for each blob an `AnalyzeJob` will be appended to your job processor q
|
|
|
75
75
|
|
|
76
76
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
77
77
|
|
|
78
|
+
## Tutorial
|
|
79
|
+
|
|
80
|
+
We wrote a [tutorial](https://avohq.io/blog/blurhash-active-storage) on how to add it to a Rails app.
|
|
81
|
+
|
|
78
82
|
## Other gems & packages
|
|
79
83
|
|
|
80
84
|
- [`avo`](https://github.com/avo-hq/avo) - Build Content management systems with Ruby on Rails
|
|
@@ -8,10 +8,21 @@ module ActiveStorage
|
|
|
8
8
|
@thumbnail = ::Vips::Image.new_from_file(
|
|
9
9
|
::ImageProcessing::Vips.source(image.filename).resize_to_limit(200, 200).call.path
|
|
10
10
|
)
|
|
11
|
+
|
|
12
|
+
@thumbnail = case @thumbnail.bands
|
|
13
|
+
when 1
|
|
14
|
+
@thumbnail.bandjoin(Array.new(3 - @thumbnail.bands, @thumbnail))
|
|
15
|
+
when 2
|
|
16
|
+
@thumbnail.bandjoin(@thumbnail.extract_band(0))
|
|
17
|
+
when 3
|
|
18
|
+
@thumbnail
|
|
19
|
+
else
|
|
20
|
+
@thumnail.extract_band(0, n: 3)
|
|
21
|
+
end
|
|
11
22
|
end
|
|
12
23
|
|
|
13
24
|
def pixels
|
|
14
|
-
@thumbnail.
|
|
25
|
+
@thumbnail.to_a.flatten
|
|
15
26
|
end
|
|
16
27
|
end
|
|
17
28
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_storage-blurhash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Rubisch
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-01-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activestorage
|