Coding/Ruby2011. 1. 8. 02:08
# save image from web
# 2011. 1. 7

require 'open-uri'

def read_url_file(url_name_, number_)
    open(url_name_) { |from| $data = from.read }
    File.open("#{number_}.jpg", "wb:binary") { |to| to.write($data) }
end

read_url_file("http://chobocho.com/photo/sydney.jpg", 2)

'Coding > Ruby' 카테고리의 다른 글

[Ruby] Simple file copy example  (0) 2011.01.07
Posted by chobocho