jr-paperclip 8.0.0.beta.2 → 8.0.0
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/.github/ISSUE_TEMPLATE/bug_report.md +7 -27
- data/NEWS +1 -1
- data/README.md +29 -22
- data/VIPS_MIGRATION_GUIDE.md +4 -1
- data/lib/paperclip/geometry_detector_factory.rb +1 -1
- data/lib/paperclip/processor.rb +1 -1
- data/lib/paperclip/version.rb +1 -1
- metadata +1 -2
- data/.github/ISSUE_TEMPLATE/custom.md +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a0a10e43e470a988afe5f30de3f2144f18bca45154654abdbf09b57817bee4b
|
|
4
|
+
data.tar.gz: 59df71bd9e4c0577f252165bf5b1d55202ffe8d363f0eae235d30db9c90b14fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ac11878b1797097dd0c6a369f39f03bc52153f2c9db2c2991d533b171a9f36fbec873b5859b55b378dbcb541d2d477f40de92d99456c7c3f5fb86c1d53eae5b
|
|
7
|
+
data.tar.gz: 8ec53d673eee2ddbfab2008ab3a3977d659dda2df53f9e7c34d9cef307b1889d53ead7ae3a3c4d4cebdc33452c9ec3e9a5c7abfefb36f46ca5e5f68ecf0bc644
|
|
@@ -7,32 +7,12 @@ assignees: ''
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Ruby version:
|
|
11
|
+
Rails version:
|
|
12
|
+
Paperclip version:
|
|
13
|
+
ImageMagick version:
|
|
14
|
+
libvips version:
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
Steps to reproduce the behavior:
|
|
15
|
-
1. Go to '...'
|
|
16
|
-
2. Click on '....'
|
|
17
|
-
3. Scroll down to '....'
|
|
18
|
-
4. See error
|
|
16
|
+
Please include your initializer, Paperclip related options, and any error message with the full backtrace.
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
A clear and concise description of what you expected to happen.
|
|
22
|
-
|
|
23
|
-
**Screenshots**
|
|
24
|
-
If applicable, add screenshots to help explain your problem.
|
|
25
|
-
|
|
26
|
-
**Desktop (please complete the following information):**
|
|
27
|
-
- OS: [e.g. iOS]
|
|
28
|
-
- Browser [e.g. chrome, safari]
|
|
29
|
-
- Version [e.g. 22]
|
|
30
|
-
|
|
31
|
-
**Smartphone (please complete the following information):**
|
|
32
|
-
- Device: [e.g. iPhone6]
|
|
33
|
-
- OS: [e.g. iOS8.1]
|
|
34
|
-
- Browser [e.g. stock browser, safari]
|
|
35
|
-
- Version [e.g. 22]
|
|
36
|
-
|
|
37
|
-
**Additional context**
|
|
38
|
-
Add any other context about the problem here.
|
|
18
|
+
If you are using an old version, have you checked the changelogs to see if your issue has been fixed in a later version?
|
data/NEWS
CHANGED
data/README.md
CHANGED
|
@@ -14,20 +14,17 @@ Legacy versions were dropped to reduce maintenance overhead and keep up with upd
|
|
|
14
14
|
|
|
15
15
|
Additional maintainers are very welcome.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
We plan to support and maintain paperclip, as well as clean it up.
|
|
17
|
+
## Version 8.0.0 brings major new features and improvements:
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
* Support for libvips backend alongside ImageMagick via the image_processing gem
|
|
20
|
+
* ImageMagick 7 support (uses `magick` command when available)
|
|
21
|
+
* Added `ALLOWED_IMAGEMAGICK_OPTIONS` security whitelist (GHSA-r4mg-4433-c7g3)
|
|
22
|
+
* Cross-platform convert_options support (-strip, -quality, -rotate, etc.)
|
|
24
23
|
|
|
25
|
-
#
|
|
24
|
+
Please check the [Image Processor](#image-processor) and [Post Processing](#post-processing) sections for more details and the [VIPS Migration Guide](https://github.com/jukra/jr-paperclip/blob/master/VIPS_MIGRATION_GUIDE.md) for migration instructions.
|
|
26
25
|
|
|
27
26
|
## Documentation valid for `master` branch
|
|
28
27
|
|
|
29
|
-
---
|
|
30
|
-
|
|
31
28
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
32
29
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
33
30
|
|
|
@@ -100,7 +97,7 @@ Requirements
|
|
|
100
97
|
|
|
101
98
|
### Ruby and Rails
|
|
102
99
|
|
|
103
|
-
Paperclip now requires Ruby version **>=
|
|
100
|
+
Paperclip now requires Ruby version **>= 3.0** and Rails version **>= 7.0**
|
|
104
101
|
(only if you're going to use Paperclip with Ruby on Rails).
|
|
105
102
|
|
|
106
103
|
### Image Processor
|
|
@@ -149,6 +146,9 @@ brew install vips
|
|
|
149
146
|
|
|
150
147
|
# Ubuntu/Debian
|
|
151
148
|
sudo apt install libvips
|
|
149
|
+
|
|
150
|
+
# If you also need the vips and vipsheader command line tools (for example custom processors)
|
|
151
|
+
sudo apt install libvips-tools
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
Then configure Paperclip to use it as the default backend in `config/initializers/paperclip.rb` (or in your environment configuration):
|
|
@@ -211,7 +211,7 @@ Paperclip is distributed as a gem, which is how it should be used in your app.
|
|
|
211
211
|
Include the gem in your Gemfile:
|
|
212
212
|
|
|
213
213
|
```ruby
|
|
214
|
-
gem "jr-paperclip", "~>
|
|
214
|
+
gem "jr-paperclip", "~> 8.0"
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
Or, if you want to get the latest, you can get master from the main paperclip repository:
|
|
@@ -723,6 +723,7 @@ has_attached_file :avatar, styles: { thumb: ["32x32#", :png] }
|
|
|
723
723
|
This will convert the "thumb" style to a 32x32 square in PNG format, regardless
|
|
724
724
|
of what was uploaded. If the format is not specified, it is kept the same (e.g.
|
|
725
725
|
JPGs will remain JPGs). `Paperclip::Thumbnail` uses the [image_processing](https://github.com/janko/image_processing) gem to process images. This allows support for both ImageMagick (via MiniMagick) and libvips backends.
|
|
726
|
+
|
|
726
727
|
[ImageMagick's geometry documentation](http://www.imagemagick.org/script/command-line-processing.php#geometry)
|
|
727
728
|
has more information on the accepted style formats, which are generally supported by both backends in Paperclip.
|
|
728
729
|
|
|
@@ -734,7 +735,7 @@ has_attached_file :image, styles: { regular: ['800x800>', :png]},
|
|
|
734
735
|
convert_options: { regular: "-posterize 3"}
|
|
735
736
|
```
|
|
736
737
|
|
|
737
|
-
Paperclip delegates to the `image_processing` gem, but **whitelists supported options** for security. For ImageMagick, most standard options are supported. For libvips, a curated set of common options is available (see table below) and `Paperclip::Thumbnail` class. Unsupported options are logged as warnings and skipped.
|
|
738
|
+
Paperclip delegates to the `image_processing` gem, but **whitelists supported options** for security. For ImageMagick, most standard options are supported. For libvips, a curated set of common options is available (see table below) and `Paperclip::Thumbnail` class for details. Unsupported options are logged as warnings and skipped.
|
|
738
739
|
|
|
739
740
|
For full backend capabilities, refer to the image_processing documentation:
|
|
740
741
|
|
|
@@ -773,14 +774,6 @@ has_attached_file :avatar,
|
|
|
773
774
|
|
|
774
775
|
**Note:** Some options only work with ImageMagick (e.g., `-density`, `-depth`, `-gravity`, `-crop`, `-trim`). When using the vips backend, these will be skipped with a warning logged.
|
|
775
776
|
|
|
776
|
-
ImageMagick supports a number of environment variables for controlling its resource limits. For example, you can enforce memory or execution time limits by setting the following variables in your application's process environment:
|
|
777
|
-
|
|
778
|
-
* `MAGICK_MEMORY_LIMIT=128MiB`
|
|
779
|
-
* `MAGICK_MAP_LIMIT=64MiB`
|
|
780
|
-
* `MAGICK_TIME_LIMIT=30`
|
|
781
|
-
|
|
782
|
-
For a full list of variables and description, see [ImageMagick's resources documentation](http://www.imagemagick.org/script/resources.php).
|
|
783
|
-
|
|
784
777
|
---
|
|
785
778
|
|
|
786
779
|
Image Processing Backends
|
|
@@ -790,16 +783,24 @@ jr-paperclip supports two image processing backends:
|
|
|
790
783
|
|
|
791
784
|
### ImageMagick (Default)
|
|
792
785
|
|
|
793
|
-
The traditional backend
|
|
786
|
+
The traditional backend. Paperclip uses the `image_processing` gem (via `mini_magick`) to generate shell commands for ImageMagick.
|
|
794
787
|
|
|
795
788
|
```ruby
|
|
796
789
|
has_attached_file :avatar,
|
|
797
790
|
styles: { thumb: "100x100#" }
|
|
798
791
|
```
|
|
799
792
|
|
|
793
|
+
ImageMagick supports a number of environment variables for controlling its resource limits. For example, you can enforce memory or execution time limits by setting the following variables in your application's process environment:
|
|
794
|
+
|
|
795
|
+
* `MAGICK_MEMORY_LIMIT=128MiB`
|
|
796
|
+
* `MAGICK_MAP_LIMIT=64MiB`
|
|
797
|
+
* `MAGICK_TIME_LIMIT=30`
|
|
798
|
+
|
|
799
|
+
For a full list of variables and description, see [ImageMagick's resources documentation](http://www.imagemagick.org/script/resources.php).
|
|
800
|
+
|
|
800
801
|
### libvips (Recommended for Performance)
|
|
801
802
|
|
|
802
|
-
libvips is significantly faster and uses less memory than ImageMagick.
|
|
803
|
+
libvips is significantly faster and uses less memory than ImageMagick. Paperclip uses the `image_processing` gem (via `ruby-vips`) to interface with libvips.
|
|
803
804
|
|
|
804
805
|
**Usage:**
|
|
805
806
|
|
|
@@ -823,6 +824,12 @@ has_attached_file :document,
|
|
|
823
824
|
}
|
|
824
825
|
```
|
|
825
826
|
|
|
827
|
+
libvips keeps a cache of recently executed operations. You can disable this for a drop in memory use:
|
|
828
|
+
```ruby
|
|
829
|
+
Vips::cache_set_max 0
|
|
830
|
+
```
|
|
831
|
+
**Note:** Typically this is not needed as libvips is already memory efficient. Disabling the cache is mostly useful in extremely memory-constrained environments (like AWS Lambda) where every MB counts. This [issue](https://github.com/libvips/ruby-vips/issues/225) has more information on memory usage.
|
|
832
|
+
|
|
826
833
|
---
|
|
827
834
|
|
|
828
835
|
Custom Attachment Processors
|
data/VIPS_MIGRATION_GUIDE.md
CHANGED
|
@@ -14,6 +14,9 @@ brew install vips
|
|
|
14
14
|
|
|
15
15
|
# Ubuntu/Debian
|
|
16
16
|
sudo apt install libvips
|
|
17
|
+
|
|
18
|
+
# If you also need the vips and vipsheader command line tools (for example custom processors)
|
|
19
|
+
sudo apt install libvips-tools
|
|
17
20
|
```
|
|
18
21
|
|
|
19
22
|
## Step 1: Update your Gemfile
|
|
@@ -23,7 +26,7 @@ sudo apt install libvips
|
|
|
23
26
|
Ensure you are using the latest version of the gem:
|
|
24
27
|
|
|
25
28
|
```ruby
|
|
26
|
-
gem "jr-paperclip", "~> 8.0
|
|
29
|
+
gem "jr-paperclip", "~> 8.0"
|
|
27
30
|
```
|
|
28
31
|
|
|
29
32
|
## Step 2: Gradual Migration (Per-Attachment)
|
|
@@ -48,7 +48,7 @@ module Paperclip
|
|
|
48
48
|
begin
|
|
49
49
|
require "vips"
|
|
50
50
|
rescue LoadError => e
|
|
51
|
-
raise Errors::CommandNotFoundError.new("Could not load ruby-vips. Please install libvips
|
|
51
|
+
raise Errors::CommandNotFoundError.new("Could not load ruby-vips. Please install libvips.")
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
begin
|
data/lib/paperclip/processor.rb
CHANGED
|
@@ -80,7 +80,7 @@ module Paperclip
|
|
|
80
80
|
begin
|
|
81
81
|
require "vips"
|
|
82
82
|
rescue LoadError
|
|
83
|
-
raise Errors::CommandNotFoundError.new("Could not load ruby-vips. Please install libvips
|
|
83
|
+
raise Errors::CommandNotFoundError.new("Could not load ruby-vips. Please install libvips.")
|
|
84
84
|
end
|
|
85
85
|
Vips::Image.new_from_file(file_path, **options)
|
|
86
86
|
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.0
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jukka Rautanen
|
|
@@ -389,7 +389,6 @@ extra_rdoc_files: []
|
|
|
389
389
|
files:
|
|
390
390
|
- ".github/FUNDING.yml"
|
|
391
391
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
392
|
-
- ".github/ISSUE_TEMPLATE/custom.md"
|
|
393
392
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
394
393
|
- ".github/workflows/reviewdog.yml"
|
|
395
394
|
- ".github/workflows/tests.yml"
|