Class: Alchemy::PictureThumb::Create

Inherits:
Object
  • Object
show all
Defined in:
app/models/alchemy/picture_thumb/create.rb

Overview

Stores the render result of a Alchemy::PictureVariant in the configured Dragonfly datastore (Default: Dragonfly::FileDataStore)

Class Method Summary collapse

Class Method Details

.call(variant, signature, uid) ⇒ Alchemy::PictureThumb

Returns The persisted thumbnail record.

Parameters:

  • variant (Alchemy::PictureVariant)

    the to be rendered image

  • signature (String)

    A unique hashed version of the rendering options

  • uid (String)

    The Unique Image Identifier the image is stored at

Returns:



17
18
19
20
21
22
23
24
25
# File 'app/models/alchemy/picture_thumb/create.rb', line 17

def call(variant, signature, uid)
  image = variant.image
  image.to_file(server_path(uid)).close
  variant.picture.thumbs.create!(
    picture: variant.picture,
    signature: signature,
    uid: uid,
  )
end