instance method transform

Ruby on Rails 8.0.4

Since v6.0.6

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

transform(file, format:)

Applies the transformations to the source image in file, producing a target image in the specified format. Yields an open Tempfile containing the target image. Closes and unlinks the output tempfile after yielding to the given block. Returns the result of the block.

Parameters

file req
format keyreq
Source
# File activestorage/lib/active_storage/transformers/transformer.rb, line 23
      def transform(file, format:)
        output = process(file, format: format)

        begin
          yield output
        ensure
          output.close!
        end
      end

Defined in activestorage/lib/active_storage/transformers/transformer.rb line 23 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Transformers::Transformer

Type at least 2 characters to search.

↑↓ navigate · open · esc close