- 21 5月, 2018 1 次提交
-
-
由 Jacob Smith 提交于
In response to https://github.com/rails/rails/issues/32917 In the current implementation, ActiveStorage passes all options to the underlying processor, including when a key has a value of false. For example, passing: ``` avatar.variant(resize: "100x100", monochrome: false, flip: "-90") ``` will return a monochrome image (or an error, pending on ImageMagick configuration) because it passes `-monochrome false` to the command (but the command line does not allow disabling flags this way, as usually a user would omit the flag entirely to disable that feature). This fix only passes those keys forward to the underlying processor if the value responds to `present?`. In practice, this means that `false` or `nil` will be filtered out before going to the processor. One possible use case would be for a user to be able to apply different filters to an avatar. The code might look something like: ``` variant_options = { monochrome: params[:monochrome], resize: params[:resize] } avatar.variant(*variant_options) ``` Obviously some sanitization may be beneficial in a real-world scenario, but this type of configuration object could be used in many other places as well. - Add removing falsy values from varaints to changelog - The entirety of #image_processing_transformation inject block was wrapped in `list.tap` to guard against the default `nil` being returned if no conditional was called. - add test for explicitly true variant options
-
- 23 4月, 2018 2 次提交
-
-
由 Janko Marohnić 提交于
-
由 Janko Marohnić 提交于
-
- 18 4月, 2018 1 次提交
-
-
由 Janko Marohnić 提交于
ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and implements an interface for common image resizing and processing. This is the canonical image processing gem recommended in [Shrine], and that's where it developed from. The initial implementation was extracted from Refile, which also implements on-the-fly transformations. Some features that ImageProcessing gem adds on top of MiniMagick: * resizing macros - #resize_to_limit - #resize_to_fit - #resize_to_fill - #resize_and_pad * automatic orientation * automatic thumbnail sharpening * avoids the complex and inefficient MiniMagick::Image class * will use "magick" instead of "convert" on ImageMagick 7 However, the biggest feature of the ImageProcessing gem is that it has an alternative implementation that uses libvips. Libvips is an alternative to ImageMagick that can process images very rapidly (we've seen up 10x faster than ImageMagick). What's great is that the ImageProcessing gem provides the same interface for both implementations. The macros are named the same, and the libvips implementation does auto orientation and thumbnail sharpening as well; only the operations/options specific to ImageMagick/libvips differ. The integration provided by this PR should work for both implementations. The plan is to introduce the ImageProcessing backend in Rails 6.0 as the default backend and deprecate the MiniMagick backend, then in Rails 6.1 remove the MiniMagick backend.
-
- 25 2月, 2018 1 次提交
-
-
由 George Claghorn 提交于
Closes #32096.
-
- 16 1月, 2018 1 次提交
-
-
由 George Claghorn 提交于
-
- 11 1月, 2018 1 次提交
-
-
由 George Claghorn 提交于
-
- 02 1月, 2018 1 次提交
-
-
由 George Claghorn 提交于
-
- 22 12月, 2017 1 次提交
-
-
由 Robert Glaser 提交于
-
- 18 12月, 2017 1 次提交
-
-
由 George Claghorn 提交于
-
- 15 12月, 2017 1 次提交
-
-
由 George Claghorn 提交于
-
- 06 10月, 2017 1 次提交
-
-
由 khall 提交于
If a variant has a large set of options associated with it, the generated filename will be too long, causing Errno::ENAMETOOLONG to be raised. This change replaces those potentially long filenames with a much more compact SHA256 hash. Fixes #30662.
-
- 29 9月, 2017 1 次提交
-
-
由 George Claghorn 提交于
-
- 14 8月, 2017 1 次提交
-
-
由 Koichi ITO 提交于
-
- 12 8月, 2017 1 次提交
-
-
由 Koichi ITO 提交于
-
- 05 8月, 2017 1 次提交
-
-
由 yuuji.yaginuma 提交于
This fixes following warnings: ``` test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized ```
-