Class: Spree::TaxonImage

Inherits:
Asset
  • Object
show all
Includes:
ImageMethods, Configuration::ActiveStorage
Defined in:
app/models/spree/taxon_image.rb,
app/models/spree/taxon_image/configuration/active_storage.rb

Defined Under Namespace

Modules: Configuration

Constant Summary

Constants inherited from Asset

Asset::EXTERNAL_URL_METAFIELD_KEY

Instance Method Summary collapse

Methods included from ImageMethods

#generate_url, #original_url

Methods inherited from Asset

#external_url, #external_url=, #product, #skip_import?

Instance Method Details

#stylesObject



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

def styles
  self.class.styles.map do |_, size|
    width, height = size[/(\d+)x(\d+)/].split('x').map(&:to_i)

    {
      url: generate_url(size: size),
      size: size,
      width: width,
      height: height
    }
  end
end