Module: Seamus::ImageProcessor
- Included in:
- File::Image
- Defined in:
- lib/seamus/processor/image_processor.rb
Instance Method Summary collapse
Instance Method Details
#thumbnail ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/seamus/processor/image_processor.rb', line 5 def thumbnail tmp = Tempfile.new(::File.basename(path)) # io = IO.new Devil.load_image(path) do |img| img.thumbnail(320) img.save("#{path}_#{::File.basename(path)}_thumb.jpg") end ::File.open("#{path}_#{::File.basename(path)}_thumb.jpg", "r") do |thumb| tmp.write thumb.read end # tmp.close tmp.rewind # io.close ::File.unlink("#{path}_#{::File.basename(path)}_thumb.jpg") # return io return tmp end |