Class: Refinery::Image
- Inherits:
-
Core::BaseModel
- Object
- Core::BaseModel
- Refinery::Image
- Includes:
- Refinery::Images::Validators
- Defined in:
- app/models/refinery/image.rb
Class Method Summary collapse
-
.per_page(dialog = false, has_size_options = false) ⇒ Object
How many images per page should be displayed?.
Instance Method Summary collapse
- #alt ⇒ Object
-
#thumbnail(options = {}) ⇒ Object
Get a thumbnail job object given a geometry and whether to strip image profiles and comments.
-
#thumbnail_dimensions(geometry) ⇒ Object
Intelligently works out dimensions for a thumbnail of this image based on the Dragonfly geometry string.
-
#title ⇒ Object
Returns a titleized version of the filename my_file.jpg returns My File.
Class Method Details
.per_page(dialog = false, has_size_options = false) ⇒ Object
How many images per page should be displayed?
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/refinery/image.rb', line 26 def per_page(dialog = false, = false) if dialog if Images. else Images.pages_per_dialog end else Images.pages_per_admin_index end end |
Instance Method Details
#alt ⇒ Object
62 63 64 |
# File 'app/models/refinery/image.rb', line 62 def alt image_alt.presence || title end |
#thumbnail(options = {}) ⇒ Object
Get a thumbnail job object given a geometry and whether to strip image profiles and comments.
40 41 42 43 44 45 46 47 |
# File 'app/models/refinery/image.rb', line 40 def thumbnail( = {}) = { :geometry => nil, :strip => false }.merge() geometry = convert_to_geometry([:geometry]) thumbnail = image thumbnail = thumbnail.thumb(geometry) if geometry thumbnail = thumbnail.strip if [:strip] thumbnail end |
#thumbnail_dimensions(geometry) ⇒ Object
Intelligently works out dimensions for a thumbnail of this image based on the Dragonfly geometry string.
50 51 52 53 |
# File 'app/models/refinery/image.rb', line 50 def thumbnail_dimensions(geometry) dimensions = ThumbnailDimensions.new(geometry, image.width, image.height) { :width => dimensions.width, :height => dimensions.height } end |
#title ⇒ Object
Returns a titleized version of the filename my_file.jpg returns My File
58 59 60 |
# File 'app/models/refinery/image.rb', line 58 def title image_title.presence || CGI::unescape(image_name.to_s).gsub(/\.\w+$/, '').titleize end |