active_storage-blurhash 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: fba342284d825997b007b2c6211737e52c9074eca393c1f9566698c3a37bf179
4
- data.tar.gz: 33f2ba27eaf2b54b21e4510414014deb2f2f864aef17524788d70db61e355420
3
+ metadata.gz: b096baa6115a2a2ca17db621b34f2a9befd1a99cce742870a5926925f21fd0ee
4
+ data.tar.gz: 0f29145747785a95ffaf9aa42a76a6885c5e2c568b604c6a57b5875f7097d30a
5
5
  SHA512:
6
- metadata.gz: '08daf2c1486f453fda2275c1c86038d93925aab11154a97136489c2fd48867e21b71d83ff40946d999b89694ac50ed95b14c8358c3230231d511a7fb2509c879'
7
- data.tar.gz: 6c7f1be0ef09d472455e2afd570d42f62b65535d62c862323941d45142cce5cc0843c2214e3150dc5259bada9bf3e2d8f302668fdced8d58ae915fa28652c1ae
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.write_to_memory.unpack("C*")
25
+ @thumbnail.to_a.flatten
15
26
  end
16
27
  end
17
28
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module Blurhash
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  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.2
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: 2024-12-12 00:00:00.000000000 Z
11
+ date: 2025-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage