2018-05-29 15:57:56 -04:00
|
|
|
* Add the ability to reflect on defined attachments using the existing
|
|
|
|
ActiveRecord reflection mechanism.
|
|
|
|
|
|
|
|
*Kevin Deisz*
|
|
|
|
|
Disable variant options when false or nil present
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
2018-05-19 22:14:57 -04:00
|
|
|
* Variant arguments of `false` or `nil` will no longer be passed to the
|
|
|
|
processor. For example, the following will not have the monochrome
|
|
|
|
variation applied:
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
avatar.variant(monochrome: false)
|
|
|
|
```
|
|
|
|
|
|
|
|
*Jacob Smith*
|
|
|
|
|
2018-05-17 17:22:00 -04:00
|
|
|
* Generated attachment getter and setter methods are created
|
|
|
|
within the model's `GeneratedAssociationMethods` module to
|
|
|
|
allow overriding and composition using `super`.
|
|
|
|
|
|
|
|
*Josh Susser*, *Jamon Douglas*
|
|
|
|
|
2018-05-16 22:12:31 -04:00
|
|
|
* Add `ActiveStorage::Blob#open`, which downloads a blob to a tempfile on disk
|
|
|
|
and yields the tempfile. Deprecate `ActiveStorage::Downloading`.
|
|
|
|
|
2018-05-17 08:01:11 -04:00
|
|
|
*David Robertson*, *George Claghorn*
|
2018-05-16 22:12:31 -04:00
|
|
|
|
2018-05-06 11:25:05 -04:00
|
|
|
* Pass in `identify: false` as an argument when providing a `content_type` for
|
|
|
|
`ActiveStorage::Attached::{One,Many}#attach` to bypass automatic content
|
|
|
|
type inference. For example:
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
@message.image.attach(
|
|
|
|
io: File.open('/path/to/file'),
|
|
|
|
filename: 'file.pdf',
|
|
|
|
content_type: 'application/pdf',
|
|
|
|
identify: false
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
*Ryan Davidson*
|
|
|
|
|
2018-05-01 23:20:56 -04:00
|
|
|
* The Google Cloud Storage service properly supports streaming downloads.
|
|
|
|
It now requires version 1.11 or newer of the google-cloud-storage gem.
|
|
|
|
|
|
|
|
*George Claghorn*
|
|
|
|
|
2018-04-23 15:27:28 -04:00
|
|
|
* Use the [ImageProcessing](https://github.com/janko-m/image_processing) gem
|
|
|
|
for Active Storage variants, and deprecate the MiniMagick backend.
|
|
|
|
|
|
|
|
This means that variants are now automatically oriented if the original
|
|
|
|
image was rotated. Also, in addition to the existing ImageMagick
|
|
|
|
operations, variants can now use `:resize_to_fit`, `:resize_to_fill`, and
|
|
|
|
other ImageProcessing macros. These are now recommended over raw `:resize`,
|
|
|
|
as they also sharpen the thumbnail after resizing.
|
|
|
|
|
|
|
|
The ImageProcessing gem also comes with a backend implemented on
|
|
|
|
[libvips](http://jcupitt.github.io/libvips/), an alternative to
|
|
|
|
ImageMagick which has significantly better performance than
|
|
|
|
ImageMagick in most cases, both in terms of speed and memory usage. In
|
|
|
|
Active Storage it's now possible to switch to the libvips backend by
|
|
|
|
changing `Rails.application.config.active_storage.variant_processor` to
|
|
|
|
`:vips`.
|
|
|
|
|
|
|
|
*Janko Marohnić*
|
|
|
|
|
2018-02-17 16:02:18 -05:00
|
|
|
* Rails 6 requires Ruby 2.4.1 or newer.
|
|
|
|
|
|
|
|
*Jeremy Daer*
|
|
|
|
|
|
|
|
|
2018-01-30 18:51:17 -05:00
|
|
|
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activestorage/CHANGELOG.md) for previous changes.
|