Sha256: 9c8fc86e8b1cfc50e9a972c83b9d031fc0a02f16d11673a92fbf9d2871a7ec46

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  class PictureThumb < ActiveRecord::Base
    class Uid
      # Returns a image variant uid for storage
      #
      # @param [String]
      # @param [Alchemy::PictureVariant]
      #
      # @return [String]
      def self.call(signature, variant)
        picture = variant.picture
        filename = variant.image_file_name || "image"
        name = File.basename(filename, ".*").gsub(/[^\w.]+/, "_")
        ext = variant.render_format

        "pictures/#{picture.id}/#{signature}/#{name}.#{ext}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alchemy-dragonfly-s3-3.6.6 app/models/alchemy/picture_thumb/uid.rb
alchemy-dragonfly-s3-3.6.5 app/models/alchemy/picture_thumb/uid.rb