Sha256: 5f9d91667a6b38fa05ae967d8c5b9ffb55aa6aed12235cd97cbb85a96de2c768
Contents?: true
Size: 776 Bytes
Versions: 2
Compression:
Stored size: 776 Bytes
Contents
require 'RMagick' module Glue # Magick transformation. #-- # TODO: pass generalized RMagick command. #++ module Thumbnails # Default thumbnail width. setting :width, :default => 128, :doc => 'Default thumbnail width' # Default thumbnail height. setting :height, :default => 128, :doc => 'Default thumbnail height' def self.generate_thumbnail(src, tname, geostring) ext = File.extname(src) dst = "#{File.join(File.dirname(src), File.basename(src, ext))}_#{tname}#{ext}" thumb = Magick::Image.read(File.join(Nitro::Server.public_root, src)).first thumb.change_geometry!(geostring) do |cols, rows, thumb| thumb.resize!(cols, rows) end thumb.write(File.join(Nitro::Server.public_root, dst)) return dst end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.41.0 | lib/glue/magick.rb |
nitro-0.40.0 | lib/glue/magick.rb |