Class: Alchemy::PictureThumb::Uid

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

Class Method Summary collapse

Class Method Details

.call(signature, variant) ⇒ String

Returns a image variant uid for storage

Parameters:

Returns:

  • (String)


12
13
14
15
16
17
18
19
# File 'app/models/alchemy/picture_thumb/uid.rb', line 12

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