Class: Spina::Image
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Spina::Image
- Defined in:
- app/models/spina/image.rb
Instance Method Summary collapse
- #content ⇒ Object
- #name ⇒ Object
- #thumbnail(size = '100x100', modifier = '^') ⇒ Object
- #variant(options) ⇒ Object
Instance Method Details
#content ⇒ Object
25 26 27 |
# File 'app/models/spina/image.rb', line 25 def content self end |
#name ⇒ Object
13 14 15 |
# File 'app/models/spina/image.rb', line 13 def name file.try(:filename).to_s end |
#thumbnail(size = '100x100', modifier = '^') ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/models/spina/image.rb', line 29 def thumbnail(size = '100x100', modifier = '^') variant( combine_options: { gravity: 'center', thumbnail: "#{size}#{modifier}", extent: size } ) end |
#variant(options) ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/models/spina/image.rb', line 17 def variant() return "" unless file.attached? return file if file.content_type.include?('svg') return file unless file.variable? file.variant() end |