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 Muchusing 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 Muchusing 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