Guest User

Untitled

a guest
Jul 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. require 'rubygems'
  2. require 'gd2-ffij'
  3. class Thumbnail
  4. include GD2
  5. def self.thumb(file_name,thumb_name,resized_width=100,resized_height=100,options={})
  6. #import image
  7. image = Image.import(file_name)
  8. #resize image by passing width and height
  9. resize_image = image.resize(resized_width, resized_height,true)
  10. # export an image to desired file format
  11. resize_image.export(thumb_name,options)
  12. end
  13. end
  14.  
  15. Thumbnail.thumb('test.jpg','thumb1.png',200,300)
Add Comment
Please, Sign In to add comment