active_storage-blurhash 0.1.2 → 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: fba342284d825997b007b2c6211737e52c9074eca393c1f9566698c3a37bf179
4
- data.tar.gz: 33f2ba27eaf2b54b21e4510414014deb2f2f864aef17524788d70db61e355420
3
+ metadata.gz: 1d1b889b0115b9f1f5ecfcc3865a2a09a3b046529494f1356ce27602c2cb63ce
4
+ data.tar.gz: c4c2a9c786cd8a926725dfd38f9063a021e9b600fda1707055983ff8a45a19a1
5
5
  SHA512:
6
- metadata.gz: '08daf2c1486f453fda2275c1c86038d93925aab11154a97136489c2fd48867e21b71d83ff40946d999b89694ac50ed95b14c8358c3230231d511a7fb2509c879'
7
- data.tar.gz: 6c7f1be0ef09d472455e2afd570d42f62b65535d62c862323941d45142cce5cc0843c2214e3150dc5259bada9bf3e2d8f302668fdced8d58ae915fa28652c1ae
6
+ metadata.gz: 046c45a6bcf58dd8cb6ff8c9b695138cd37de6eea42da1943ac058d94a73a815f5aa9a520c47d081f6e35842af079a93b5dd2c9889b2a4100ff41b2d094f94fb
7
+ data.tar.gz: 9bd1b1ef735ec22b9d5f9aa054b0743e7706c3b0445cf6b39381247692e5018c739dcfc4c40f2427afb69488e06e0acb438f40e29c9777e9f2c188f1bfbfe30a
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
@@ -6,7 +6,7 @@ module ActiveStorage
6
6
 
7
7
  def initialize(image)
8
8
  @thumbnail = MiniMagick::Image.open(
9
- ::ImageProcessing::MiniMagick.source(image.path).resize_to_limit(200, 200).call.path
9
+ ::ImageProcessing::MiniMagick.source(image.path).resize_to_limit(200, 200).loader(page: 0).call.path
10
10
  )
11
11
  end
12
12
 
@@ -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
+ @thumbnail.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.4"
4
4
  end
5
5
  end
@@ -0,0 +1,5 @@
1
+ module ActiveStorage
2
+ module Blurhash
3
+ VERSION = "0.1.3"
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Rubisch
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-12 00:00:00.000000000 Z
10
+ date: 2025-03-10 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activestorage
@@ -166,6 +165,7 @@ files:
166
165
  - lib/active_storage/blurhash/thumbnail/vips.rb
167
166
  - lib/active_storage/blurhash/thumbnail/vips.rb~
168
167
  - lib/active_storage/blurhash/version.rb
168
+ - lib/active_storage/blurhash/version.rb~
169
169
  - lib/generators/active_storage/blurhash/install/USAGE
170
170
  - lib/generators/active_storage/blurhash/install/USAGE~
171
171
  - lib/generators/active_storage/blurhash/install/install_generator.rb
@@ -180,7 +180,6 @@ licenses:
180
180
  metadata:
181
181
  homepage_uri: https://github.com/avo-hq/active_storage-blurhash
182
182
  source_code_uri: https://github.com/avo-hq/active_storage-blurhash
183
- post_install_message:
184
183
  rdoc_options: []
185
184
  require_paths:
186
185
  - lib
@@ -195,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
194
  - !ruby/object:Gem::Version
196
195
  version: '0'
197
196
  requirements: []
198
- rubygems_version: 3.5.19
199
- signing_key:
197
+ rubygems_version: 3.6.2
200
198
  specification_version: 4
201
199
  summary: Use blurhashes to lazy load ActiveStorage images
202
200
  test_files: []