E D R S I H C RSS
ID
Password
Join
Many changes of mind and mood; do not hesitate too long.

FrontPage SaveImageFileFromWeb

# 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)
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2011-01-08 02:07:02
Processing time 0.0285 sec