I'm trying to copy an image from a website, but can't seem to get it
right.
I know rio can copy a website in one line, but what about images?
Anyone have a good snippet using open-uri or something?
I'm trying to copy an image from a website, but can't seem to get it
right.
I know rio can copy a website in one line, but what about images?
Anyone have a good snippet using open-uri or something?
web page = (virtual) file
image = (virtual) file
just use open-uri + read and write the contents somewhere.
require 'open-uri'
File.open('logo.gif', 'wb') do |f|
f.write(open('http://www.google.com/intl/en_ALL/images/logo.gif'\).read)
end
J.
On Nov 19, 2007 7:00 PM, _Stud <studlee2@gmail.com> wrote:
I'm trying to copy an image from a website, but can't seem to get it
right.I know rio can copy a website in one line, but what about images?
Anyone have a good snippet using open-uri or something?
Using mechanize:
require 'mechanize'
agent = WWW::Mechanize.new
img = agent.get("http://www.example.com/image.jpg"\)
img.save
will load the JPEG image image.jpg from the site www.example.com and
save it as image.jpg on the local filesystem.
On Nov 20, 2007 2:00 AM, _Stud <studlee2@gmail.com> wrote:
I'm trying to copy an image from a website, but can't seem to get it
right.I know rio can copy a website in one line, but what about images?
Anyone have a good snippet using open-uri or something?
--
普通じゃないのが当然なら答える私は何ができる?
普通でも普通じゃなくて感じるまま感じることだけをするよ!
http://stormwyrm.blogspot.com
Hi All,
Get all images from given URL
Desktop Application from jazzez
Kindly go through below link and download the EXE file.
http://www.box.net/shared/m5vxqpr3r1
Install in Windows machine and enjoy with impressed images
Regards,
P.Raveendran
--
Posted via http://www.ruby-forum.com/.