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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2020e672706019bc2f09c85e93f350cb076e1734e3b86d6083d57f41d6f0a62e
4
- data.tar.gz: c18c81c981656da9ee280b5394123e5bb965ce2ca50b9cacf0e6fbacc7dddeaf
3
+ metadata.gz: 0bf6d2199b379f319c4424dd1b25d19d31a8b75cfd3b8eadc7a55d1d10251a5b
4
+ data.tar.gz: 7c477097c4d74ca8714efdd8c5e165d9bf78f431c6d1896853f7f10cee65022d
5
5
  SHA512:
6
- metadata.gz: 20acbf5988e931bbf2825b4d9515dce71bbf9f854ae307b235ec280b9e71d023cd17bd63a3c9cc7dd217f8311c3d882a7311ed42d275c5d5f65da2d73dff9a9c
7
- data.tar.gz: 31e48aaa2f00722b445bcc1fc7af6bc1f1440cbc6ee6632442c5c9e234fb15fb8e485bf8e41af84ced410949a129231f6c18e154f387f7401d5a6819548631eb
6
+ metadata.gz: db924c0c50def20d4159d4733f677bed3e032d73e6095e51fecd8b0f8cd4fd65fa3b2505ad31fe479be2df16694b964def07e90e7ae2ee1b5021632b35adf74d
7
+ data.tar.gz: 3ea4b022b05429712551a77322d70d40339728f3e24df68841e2da9f44342324682b97081f6e58bef27072e2480231f996672cd274c939d8426ef9b7c7a120a2
@@ -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
@@ -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
 
@@ -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
- # Auto-orient based on EXIF data
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 ||= begin
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("-format %n :file", file: File.expand_path(@file.path)).to_i > 1
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paperclip
4
- VERSION = "8.0.6"
4
+ VERSION = "8.0.8"
5
5
  end
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.6
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.10
530
+ rubygems_version: 4.0.20
531
531
  specification_version: 4
532
532
  summary: File attachments as attributes for ActiveRecord
533
533
  test_files: []