Picture

How to download picture from the particular url ?
THanks Much

···

--
Posted via http://www.ruby-forum.com/.

Newb Newb wrote:

How to download picture from the particular url ?
THanks Much

using Mechanize you could do it like this ( if I remember correctly ) :

agent = WWW::Mechanize.new
link = some_site.com/whatever.jpg
agent.get(link).save_as(File.basename(link))

···

--
Posted via http://www.ruby-forum.com/.

require 'open-uri'

imgurl = "URL to photo"
photo = open(imgurl,"rb") { |io| io.read }

···

On Aug 28, 2008, at 1:09 PM, Newb Newb wrote:

How to download picture from the particular url ?
THanks Much
--
Posted via http://www.ruby-forum.com/.

Newb Newb wrote:

How to download picture from the particular url ?
THanks Much

···

--
Posted via http://www.ruby-forum.com/.

Lex Williams wrote:

Newb Newb wrote:

How to download picture from the particular url ?
THanks Much

using Mechanize you could do it like this ( if I remember correctly ) :

agent = WWW::Mechanize.new
link = some_site.com/whatever.jpg
agent.get(link).save_as(File.basename(link))

How about implementing using 'open uri'
Help needed..

···

--
Posted via http://www.ruby-forum.com/.

Newb Newb wrote:

Lex Williams wrote:

Newb Newb wrote:

How to download picture from the particular url ?
THanks Much

using Mechanize you could do it like this ( if I remember correctly ) :

agent = WWW::Mechanize.new
link = some_site.com/whatever.jpg
agent.get(link).save_as(File.basename(link))

How about implementing using 'open uri'
Help needed..

File.open("some_pic.jpg") do |file|
   file.puts open("some_site.com/some_pic.jpg").read
end

···

--
Posted via http://www.ruby-forum.com/.