jr-paperclip 8.0.6 → 8.0.8
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/{NEWS → CHANGELOG.md} +14 -0
- data/lib/paperclip/attachment.rb +1 -2
- data/lib/paperclip/thumbnail.rb +20 -18
- data/lib/paperclip/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0bf6d2199b379f319c4424dd1b25d19d31a8b75cfd3b8eadc7a55d1d10251a5b
|
|
4
|
+
data.tar.gz: 7c477097c4d74ca8714efdd8c5e165d9bf78f431c6d1896853f7f10cee65022d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db924c0c50def20d4159d4733f677bed3e032d73e6095e51fecd8b0f8cd4fd65fa3b2505ad31fe479be2df16694b964def07e90e7ae2ee1b5021632b35adf74d
|
|
7
|
+
data.tar.gz: 3ea4b022b05429712551a77322d70d40339728f3e24df68841e2da9f44342324682b97081f6e58bef27072e2480231f996672cd274c939d8426ef9b7c7a120a2
|
data/{NEWS → CHANGELOG.md}
RENAMED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
8.0.8 (2026-10-21)
|
|
2
|
+
|
|
3
|
+
* Performance: Let eligible vips resizes use native file thumbnailing instead of loading and
|
|
4
|
+
autorotating the full-resolution image first. Explicit source loader options and frame selection
|
|
5
|
+
still take precedence. Native thumbnailing can change resampling and output dimension rounding;
|
|
6
|
+
requested geometry and encoder settings are unchanged. Explicit sequential access retains the old path.
|
|
7
|
+
* Bugfix: Honor auto_orient: false with vips, including image_processing's fallback autorotation.
|
|
8
|
+
|
|
9
|
+
8.0.7 (2026-06-11)
|
|
10
|
+
|
|
11
|
+
* Performance: Fix repeated animation probing in Thumbnail.
|
|
12
|
+
* Bugfix: The global backend (Paperclip.options[:backend]) is now read at processing time instead of
|
|
13
|
+
being captured into Attachment.default_options when that hash is first built.
|
|
14
|
+
|
|
1
15
|
8.0.6 (2026-05-22)
|
|
2
16
|
|
|
3
17
|
* Chore: Update image_processing runtime dependency to ~> 2.0
|
data/lib/paperclip/attachment.rb
CHANGED
|
@@ -36,8 +36,7 @@ module Paperclip
|
|
|
36
36
|
validate_media_type: true,
|
|
37
37
|
adapter_options: { hash_digest: Digest::MD5 },
|
|
38
38
|
check_validity_before_processing: true,
|
|
39
|
-
return_file_attributes_on_destroy: false
|
|
40
|
-
backend: Paperclip.options[:backend]
|
|
39
|
+
return_file_attributes_on_destroy: false
|
|
41
40
|
}
|
|
42
41
|
end
|
|
43
42
|
|
data/lib/paperclip/thumbnail.rb
CHANGED
|
@@ -190,21 +190,7 @@ module Paperclip
|
|
|
190
190
|
def build_pipeline(source_path)
|
|
191
191
|
pipeline = image_processing_module.source(source_path)
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
if auto_orient
|
|
195
|
-
if backend == :vips
|
|
196
|
-
pipeline = pipeline.loader(autorotate: true)
|
|
197
|
-
elsif backend == :image_magick
|
|
198
|
-
pipeline = pipeline.auto_orient
|
|
199
|
-
end
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
# For vips backend, default to sequential access for better memory efficiency.
|
|
203
|
-
# Sequential access streams the image from top to bottom, keeping only a few
|
|
204
|
-
# scanlines in memory. Users can override via source_file_options: { access: :random }
|
|
205
|
-
if backend == :vips
|
|
206
|
-
pipeline = pipeline.loader(access: :sequential)
|
|
207
|
-
end
|
|
193
|
+
pipeline = pipeline.loader(auto_orient: auto_orient) if backend == :image_magick
|
|
208
194
|
|
|
209
195
|
# Handle source file options
|
|
210
196
|
if @source_file_options
|
|
@@ -238,6 +224,18 @@ module Paperclip
|
|
|
238
224
|
pipeline = apply_resize(pipeline)
|
|
239
225
|
end
|
|
240
226
|
|
|
227
|
+
if backend == :vips
|
|
228
|
+
# An empty loader lets image_processing use file thumbnailing, which shrinks
|
|
229
|
+
# before autorotating and uses sequential decoding internally. Keep explicit
|
|
230
|
+
# loaders and frame selection unchanged.
|
|
231
|
+
resize_on_load = pipeline.options[:operations].dig(0, 0).to_s.start_with?("resize_")
|
|
232
|
+
unless auto_orient && resize_on_load && pipeline.options[:loader].empty?
|
|
233
|
+
defaults = { access: :sequential }
|
|
234
|
+
defaults.merge!(auto_orient ? { autorotate: true } : { autorot: false })
|
|
235
|
+
pipeline = pipeline.loader(**defaults.merge(pipeline.options[:loader]))
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
241
239
|
# Handle animated images (GIF, WebP)
|
|
242
240
|
if animated?
|
|
243
241
|
if backend == :image_magick
|
|
@@ -641,12 +639,16 @@ module Paperclip
|
|
|
641
639
|
end
|
|
642
640
|
|
|
643
641
|
def animated_source?
|
|
644
|
-
@animated_source
|
|
642
|
+
return @animated_source if defined?(@animated_source)
|
|
643
|
+
|
|
644
|
+
@animated_source = begin
|
|
645
645
|
case backend
|
|
646
646
|
when :vips
|
|
647
|
-
vips_image(File.expand_path(@file.path)).get("n-pages").to_i > 1
|
|
647
|
+
vips_image(File.expand_path(@file.path), access: :sequential).get("n-pages").to_i > 1
|
|
648
648
|
when :image_magick
|
|
649
|
-
identify
|
|
649
|
+
# Limit identify to the first two frames: counting all frames with
|
|
650
|
+
# %n decodes the entire file, which is expensive for large animations.
|
|
651
|
+
identify("-format %n :file", file: "#{File.expand_path(@file.path)}[0-1]").to_i > 1
|
|
650
652
|
else
|
|
651
653
|
extension_indicates_animation?
|
|
652
654
|
end
|
data/lib/paperclip/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jr-paperclip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.0.
|
|
4
|
+
version: 8.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jukka Rautanen
|
|
@@ -427,9 +427,9 @@ extensions: []
|
|
|
427
427
|
extra_rdoc_files: []
|
|
428
428
|
files:
|
|
429
429
|
- ".rubocop.yml"
|
|
430
|
+
- CHANGELOG.md
|
|
430
431
|
- CONTRIBUTING.md
|
|
431
432
|
- LICENSE
|
|
432
|
-
- NEWS
|
|
433
433
|
- README.md
|
|
434
434
|
- RELEASING.md
|
|
435
435
|
- Rakefile
|
|
@@ -527,7 +527,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
527
527
|
version: '0'
|
|
528
528
|
requirements:
|
|
529
529
|
- ImageMagick or libvips
|
|
530
|
-
rubygems_version: 4.0.
|
|
530
|
+
rubygems_version: 4.0.20
|
|
531
531
|
specification_version: 4
|
|
532
532
|
summary: File attachments as attributes for ActiveRecord
|
|
533
533
|
test_files: []
|