2014-09-21 76 views
0

Rmagick文檔不是最清楚的,我試過所有,但它不喜歡它?也許我誤解Magick :: Info如何工作?更改圖像文件名稱rmagick

http://www.imagemagick.org/RMagick/doc/info.html

def crop_photo(url, x, y, w, h) 
image = Magick::ImageList.new 
urlimage = open(url) 
format = url.split('/')[-1].strip.split('?')[0].strip 
image.from_blob(urlimage.read) 
crop = image.crop(x,y,w,h) 
image = crop.to_blob 
    image.filename = format #doesn't work 
    self.filename = format #doesn't work 
end 

的幫助感激

回答

1

爲了節省圖像或ImageList中使用write方法:

image.write(new_filename)

+0

更改文件名我必須寫? – 2014-09-21 12:05:55