Picture

How to download picture from the particular url ?
THanks Much

Newb N. 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))

Lex W. wrote:

Newb N. 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…

Newb N. wrote:

Lex W. wrote:

Newb N. 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

require ‘open-uri’

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

Newb N. wrote:

How to download picture from the particular url ?
THanks Much

http://al2o3-cr.blogspot.com/2008/08/downloading-file.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs