Sha256: b6965e32395236ca0f4c88f6c3020f5b4baaf9b847d2ec23aa638127fbd557e4
Contents?: true
Size: 803 Bytes
Versions: 2
Compression:
Stored size: 803 Bytes
Contents
module Alchemy class PictureThumb < BaseRecord # Stores the render result of a Alchemy::PictureVariant # in the Dragonfly S3 datastore # class Create def self.call(variant, signature, uid) # create the thumb before uploading # to prevent db race conditions thumb = variant.picture.thumbs.create!( picture: variant.picture, signature: signature, uid: uid, ) begin # fetch and process the image image = variant.image # upload the processed image image.store(path: uid) rescue RuntimeError, Excon::Error => e Rails.logger.warn(e) # destroy the thumb if processing or upload fails thumb.destroy end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alchemy-dragonfly-s3-4.0.5 | app/models/alchemy/picture_thumb/create.rb |
alchemy-dragonfly-s3-5.0.6 | app/models/alchemy/picture_thumb/create.rb |