Sha256: 7434ddccc917473f5267593db455c95a47399144e003d531511f48f6bafc35f4
Contents?: true
Size: 793 Bytes
Versions: 2
Compression:
Stored size: 793 Bytes
Contents
# frozen_string_literal: true module Alchemy module Dragonfly module S3 class CreatePictureThumb 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alchemy-dragonfly-s3-5.2.0 | lib/alchemy/dragonfly/s3/create_picture_thumb.rb |
alchemy-dragonfly-s3-5.1.5 | lib/alchemy/dragonfly/s3/create_picture_thumb.rb |