Class: SpreeCmCommissioner::Asset

Inherits:
Spree::Asset
  • Object
show all
Includes:
Spree::Image::Configuration::ActiveStorage, Spree::ImageMethods
Defined in:
app/models/spree_cm_commissioner/asset.rb

Instance Method Summary collapse

Instance Method Details

#stylesObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/spree_cm_commissioner/asset.rb', line 7

def styles
  asset_styles.map do |_, size|
    width, height = size[/(\d+)x(\d+)/].split('x')

    {
      url: cdn_image_url(attachment.variant(resize_to_limit: [width.to_i, height.to_i])),
      width: width,
      height: height
    }
  end
end