aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models/active_storage/variation.rb
Commit message (Collapse)AuthorAgeFilesLines
* normalize the hash of transformationsYi Feng2019-04-201-1/+1
|
* Squish the deprecation messages across the codebasePrathamesh Sonpatki2019-03-111-1/+1
| | | | | | | | | | | | | | | | Sample example -> Before: prathamesh@Prathameshs-MacBook-Pro-2 blog *$ rails server thin DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead. After: prathamesh@Prathameshs-MacBook-Pro-2 squish_app *$ rails server thin DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead.
* Prefer ImageProcessing's resize_to_limit macro over resize_to_fitGeorge Claghorn2019-01-241-1/+1
| | | | Don't upsize images smaller than the specified dimensions.
* Extract transformersGeorge Claghorn2018-08-101-62/+17
|
* Avoid 2.6 warning: shadowing outer local variable - listutilum2018-05-231-8/+6
|
* Disable variant options when false or nil presentJacob Smith2018-05-211-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Don't swallow LoadError raised for missing libvipsJanko Marohnić2018-04-231-3/+7
|
* Recommend using :resize_to_fit after allJanko Marohnić2018-04-231-1/+1
|
* Rename ActiveStorage.processor to .variant_processorJanko Marohnić2018-04-221-2/+2
|
* Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-181-18/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Document :combine_optionsRobert Glaser2018-02-081-0/+8
| | | | Turns out this is still undocumented functionality.
* Instrument image transformationGeorge Claghorn2018-01-101-7/+9
|
* Restore support for the -layers transformationGeorge Claghorn2018-01-021-14/+14
|
* prevent shadowing outer variablesDorian Marié2017-12-251-4/+4
|
* Add support for combined MiniMagick transformationsRobert Glaser2017-12-221-6/+16
|
* Fix optimizing GIF variants using mogrify's -layers optionGeorge Claghorn2017-12-111-5/+7
|
* Revert "Invoke mogrify once when transforming an image"George Claghorn2017-12-111-8/+6
| | | | This reverts commit a80f81af055f02bf4625c90470aa90441cf6fc24.
* Invoke mogrify once when transforming an imageGeorge Claghorn2017-12-111-6/+8
| | | | Execute a single mogrify command with multiple options rather than one command per option. Permit the use of all mogrify options, not just the ones that fall through to MiniMagick::Image#method_missing.
* Accept variation keys in #preview and #variantGeorge Claghorn2017-10-121-5/+10
|
* Preview PDFs and videosGeorge Claghorn2017-09-281-0/+9
|
* Remove unused require in ActiveStorage::VariationYoshiyuki Hirano2017-09-181-2/+0
|
* Enable links in Active Storage docs [ci skip]Yoshiyuki Hirano2017-08-261-1/+1
|
* minor tweaks in Active Storage after a walkthroughXavier Noria2017-08-151-3/+3
|
* Use frozen string literal in Active StorageKoichi ITO2017-08-121-0/+2
|
* Fix formatting of Active Storage docs [ci skip]Koichi ITO2017-08-111-4/+4
| | | | Follow up of #30188.
* Make Rubocop happier about ActiveStorageclaudiob2017-08-031-1/+1
| | | | | | | | | | | | Running `rubocop activestorage` before this commit resulted in 20 offenses. This commit only fixes: - Trailing whitespace detected - Space inside } missing - Put one space between the method name and the first argument. The other offenses are left since they are intentional according to @georgeclaghorn (https://github.com/rails/rails/pull/30061#issuecomment-319999190)
* Add 'activestorage/' from commit '3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58'Rafael Mendonça França2017-07-311-0/+53
git-subtree-dir: activestorage git-subtree-mainline: 0d58e7e478e79c2d6b2a39a4444d2a17a903b2a6 git-subtree-split: 3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58