Method: ActFunc::Fileupload.resize
- Defined in:
- lib/act_func/fileupload.rb
.resize(imagepath, w, h) ⇒ Object
image resize params: imagepath-> image file path; w-> new image width; h-> new image height
105 106 107 108 109 110 111 112 113 |
# File 'lib/act_func/fileupload.rb', line 105 def Fileupload.resize(imagepath, w, h) img = Magick::Image.read(imagepath)[0] if w==0 || h==0 w=img.columns h=img.rows end newimg = img.resize_to_fill(w, h) newimg.write(imagepath) end |