Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'gd2-ffij'
- class Thumbnail
- include GD2
- def self.thumb(file_name,thumb_name,resized_width=100,resized_height=100,options={})
- #import image
- image = Image.import(file_name)
- #resize image by passing width and height
- resize_image = image.resize(resized_width, resized_height,true)
- # export an image to desired file format
- resize_image.export(thumb_name,options)
- end
- end
- Thumbnail.thumb('test.jpg','thumb1.png',200,300)
Add Comment
Please, Sign In to add comment