aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models
Commit message (Collapse)AuthorAgeFilesLines
* Don't swallow LoadError raised for missing libvipsJanko Marohnić2018-04-231-3/+7
|
* Recommend using :resize_to_fit after allJanko Marohnić2018-04-234-12/+12
|
* Remove warning that image will be loaded into memoryJanko Marohnić2018-04-231-4/+4
| | | | | This is not true anymore, the image will be downloaded into a temporary file in a streaming fashion.
* Show ImageProcessing macros in a dedicated exampleJanko Marohnić2018-04-231-13/+12
|
* Ensure result file is deleted on uploading errorsJanko Marohnić2018-04-221-4/+10
|
* Rename ActiveStorage.processor to .variant_processorJanko Marohnić2018-04-222-4/+4
|
* Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-182-52/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix leftover references to VariantsController [ci skip]dixpac2018-04-082-4/+4
| | | | | VariantsController has been merged to RepresentationsController, this PR fixes outdated references to VariantsController in ActiveStorage documentation.
* Use a current model to provide the host for service urlsAndrew White2018-04-061-0/+5
| | | | | | | Trying to pass the current request down to the service so that it can create full urls instead of paths makes the API messy so use a model based on ActiveSupport::CurrentAttributes to provide the current host to services that need it (primarily the disk service).
* Flip the order of the after_create callbacksDwight Watson2018-03-271-1/+1
| | | | | | | | | | Addresses rails/rails#32247 Add test that checks identify and analyze work in correct order Break out direct upload test helper Review changes for direct-upload test helper
* Provide an alternative PDF previewer based on PopplerTerence Lee2018-03-061-4/+3
| | | | | | mutool is licensed under the Affero GPL, which has strict distribution requirements. Poppler is licensed under the more liberal GPL, making it a good alternative for those who can't use mutool.
* Generate root-relative paths in Active Storage disk service URL methodsGeorge Claghorn2018-03-052-38/+7
| | | | Fixes #32129.
* Merge Previews/Variants controller into one Representations controller.Kasper Timm Hansen2018-03-031-2/+2
| | | | | | | | | Since ActiveStorage::Blob::Representable unifies the idea of previews and variants under one roof as representation, we may as well have the controllers follow suit. Thus ActiveStorage::RepresenationsController enters the fray. I've copied the old tests for both previews and variants and unified those as well.
* Use lazy load hook to configure ActiveStorage::BlobEugene Kenny2018-02-251-0/+2
| | | | | | | | | `to_prepare` callbacks are run during initialization; using one here meant that `ActiveStorage::Blob` would be loaded when the app boots, which would in turn load `ActiveRecord::Base`. By using a lazy load hook to configure `ActiveStorage::Blob` instead, we can avoid loading `ActiveRecord::Base` unnecessarily.
* Support varying ICO filesGeorge Claghorn2018-02-241-1/+1
| | | | Closes #32096.
* Hoist update for clarityGeorge Claghorn2018-02-202-8/+8
|
* Undocument ActiveStorage::IdentificationGeorge Claghorn2018-02-201-1/+1
|
* Correct Range header syntaxGeorge Claghorn2018-02-201-1/+1
|
* Use require_dependency inside Active StorageEugene Kenny2018-02-142-3/+9
| | | | | | | | | | | | | | | Active Storage is an engine which means its models, jobs and controllers are autoloaded by Rails rather than Ruby. Unfortunately this means it's subject to the same gotchas as applications, including this one: http://guides.rubyonrails.org/v5.1.4/autoloading_and_reloading_constants.html#when-constants-aren-t-missed-qualified-references On Ruby < 2.5, constants nested under classes can't be autoloaded by Rails if a top level constant already exists with the same name. To avoid clashing with constants defined in users' applications or gems, we can use `require_dependency` to ensure that the nested constants are loaded before they're used.
* Document MuPDF version requirementGeorge Claghorn2018-02-131-1/+1
|
* Add ActiveStorage::Blob.unattached scopefatkodima2018-02-121-0/+2
|
* Use full class names when including concerns to avoid collisionsWojtek Wrona2018-02-121-1/+3
|
* Add missing requireGeorge Claghorn2018-02-111-0/+2
|
* Merge pull request #31927 from mrreynolds/patch-2Eileen M. Uchitelle2018-02-091-0/+8
|\ | | | | Document :combine_options
| * Document :combine_optionsRobert Glaser2018-02-081-0/+8
| | | | | | | | Turns out this is still undocumented functionality.
* | Fix `blob.service_url` for supports string or nil `:filename` option.Jason Lee2018-02-082-1/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | | - Make sure `blob.service_url` present a `ActiveStorage::Filename` type to `serivce.url`. - Add `ActiveStorage::Filename.wrap` method. before: ```rb blob.service_url(filename: ActiveStorage::Filename.new("new.txt")) blob.service_url(filename: "new.txt") => NoMethodError: undefined method `parameters' for "new.txt":String params = {} blob.service_url(filename: params[:filename]) => NoMethodError: undefined method `parameters' for nil:NilClass ``` after: ```rb blob.service_url(filename: "new.txt") blob.service_url(filename: nil) ```
* Merge pull request #31854 from huacnlee/allow-more-options-for-service-urlGeorge Claghorn2018-02-011-2/+3
|\ | | | | Allow ActiveStorage::Blob#service_url to pass addition options to service.url
| * Allow `ActiveStorage::Blob#service_url` to pass addition options to ↵Jason Lee2018-02-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `service.url`. Because there have some service needs more parameters for file URL: https://www.alibabacloud.com/help/doc-detail/44687.htm ```rb class AliyunService < Service def url(key, options = {}) image_process = options[:oss_process] || "image/resize,w_800" "http://image-demo.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=#{image_process}" end end ``` Use case: ```erb <%= image_tag @user.avatar.service_url(oss_process: "image/resize,m_fill,h_100,w_100" %> ```
* | Use the full class name for the JSON coder, as there may be anotherRenaud Chaput2018-02-011-1/+1
|/ | | | | | `JSON` constant defined. For example when using the `representable` gem: https://github.com/trailblazer/representable/issues/224
* Extract content types from blob dataGeorge Claghorn2018-01-154-5/+64
|
* Instrument image transformationGeorge Claghorn2018-01-101-7/+9
|
* Update error names in docs [ci skip]George Claghorn2018-01-101-3/+3
|
* Add missing `# frozen_string_literal: true`Ryuta Kamizono2018-01-112-0/+4
|
* Correct comment [ci skip]George Claghorn2018-01-101-1/+1
|
* Extract Analyzable and Representable concernsGeorge Claghorn2018-01-103-147/+148
|
* Allow overriding filename in `Blob#service_url`Rosa Gutierrez2018-01-081-1/+1
| | | | | | | This is useful when we have several representations for the same underlying file, each one with a different name, and we need to provide a custom download URL based on that name and not that of the underlying file.
* Force content disposition to attachment for specific content typesRosa Gutierrez2018-01-051-2/+7
| | | | | | | | | | | | | | In this way we avoid HTML, XML, SVG and other files that can be rendered by the browser to be served inline by default. Depending on the origin from where these files are served, this might lead to XSS vulnerabilities, and in the best case, to more realistic phishing attacks and open redirects. We force it rather than falling back to it when other disposition is not provided. Otherwise it would be possible for someone to force inline just by passing `disposition=inline` in the URL. The list of content types to be served as attachments is configurable.
* 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
|
* [ci skip] Remove needless from doc for ActiveStorage::VariantYoshiyuki Hirano2017-12-221-1/+1
|
* Delete MiniMagick tempfile when transformation failsGeorge Claghorn2017-12-181-1/+7
|
* Ensure MiniMagick tempfiles are properly unlinked after image transformationGeorge Claghorn2017-12-181-9/+18
|
* Convert non-web image (e.g. PSD) variants to PNGGeorge Claghorn2017-12-181-3/+34
|
* Update ActiveStorage::Blob#transformation docs [ci skip]George Claghorn2017-12-161-3/+3
|
* Restrict variants to variable image blobsGeorge Claghorn2017-12-151-4/+18
|
* Exclude ActiveStorage::Filename{#parameters,::Parameters} from API docs [ci ↵George Claghorn2017-12-132-2/+2
| | | | skip]
* 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.