c# - How to select specific images and save from a particular url? (Description Inside) -
i need select , save specific images site entering url in textbox in site.
i've loaded images site url, using html agility. don't know how select , save.
for example, enter http://flipkart.com/ in text box, should load images page, assume contains 9 images, if 9 images loaded site , displayed gallery, gallery select 1 image click save. should save somewhere in site(may particular folder).
i don't know how save images site.
would give reference or ideas achieve task of saving image loaded when url given.
thanks!
i googled , got below code,
public system.drawing.image downloadimagefromurl(string imageurl) { system.drawing.image image = null; try { system.net.httpwebrequest webrequest = (system.net.httpwebrequest)system.net.httpwebrequest.create(imageurl); webrequest.allowwritestreambuffering = true; webrequest.timeout = 30000; system.net.webresponse webresponse = webrequest.getresponse(); system.io.stream stream = webresponse.getresponsestream(); image = system.drawing.image.fromstream(stream); webresponse.close(); } catch (exception ex) { return null; } return image; }
u use code , save image of desired format.
while saving image should mention folder/destination path.