Class: CheesyGallery::ImageThumb
- Inherits:
-
BaseImageFile
- Object
- Jekyll::StaticFile
- BaseImageFile
- CheesyGallery::ImageThumb
- Defined in:
- lib/cheesy-gallery/image_thumb.rb
Overview
This StaticFile subclass represents thumbnail images for each image. On ‘write()` it renders a 150x150 center crop of the source
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(site, collection, file, postfix, height, width) ⇒ ImageThumb
constructor
A new instance of ImageThumb.
-
#process_and_write(img, path) ⇒ Object
instead of copying, renders the thumbnail.
Methods inherited from BaseImageFile
Constructor Details
#initialize(site, collection, file, postfix, height, width) ⇒ ImageThumb
Returns a new instance of ImageThumb.
10 11 12 13 14 15 |
# File 'lib/cheesy-gallery/image_thumb.rb', line 10 def initialize(site, collection, file, postfix, height, width) super(site, collection, file, file.name + postfix) @height = height @width = width end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
8 9 10 |
# File 'lib/cheesy-gallery/image_thumb.rb', line 8 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
8 9 10 |
# File 'lib/cheesy-gallery/image_thumb.rb', line 8 def width @width end |
Instance Method Details
#process_and_write(img, path) ⇒ Object
instead of copying, renders the thumbnail
18 19 20 21 |
# File 'lib/cheesy-gallery/image_thumb.rb', line 18 def process_and_write(img, path) img.resize_to_fill!(height, width) img.write(path) end |