Class: Thwomp::Thumbnail
- Inherits:
-
Object
- Object
- Thwomp::Thumbnail
- Defined in:
- lib/thwomp/thumbnail.rb
Class Method Summary collapse
Class Method Details
.generate!(path, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/thwomp/thumbnail.rb', line 8 def self.generate!(path, ={}) width = .fetch(:width, 128) height = .fetch(:height, 128) filename = path.gsub(/frame/, 'thumbnail') begin thumbnail = ChunkyPNG::Image.from_file(path) thumbnail.resample_bilinear!(width, height) thumbnail.save(filename) filename rescue ChunkyPNG::Exception, RangeError, NoMethodError false end end |