IronWebScraper - The C# Web Scraping Library
WebScraperDownloadImage Method (String, String, Int32, Int32, Boolean, HttpIdentity) |
Requests a file to be downloaded from the given Url to the local file-system. Often used for scraping documents, assets and images.
Normally called with an Parse Method of IronWebScraper.WebScraper
Namespace: IronWebScraper
Assembly: IronWebScraper (in IronWebScraper.dll) Version: 4.0.4.25470 (4.0.4.3)

public virtual string DownloadImage( string url, string path, int maxWidth = 0, int maxHeight = 0, bool overWrite = false, HttpIdentity identity = null )
Public Overridable Function DownloadImage ( url As String, path As String, Optional maxWidth As Integer = 0, Optional maxHeight As Integer = 0, Optional overWrite As Boolean = false, Optional identity As HttpIdentity = Nothing ) As String
Parameters
- url
- Type: SystemString
The absolute url of the resource to be downloaded. - path
- Type: SystemString
The path to which the downloaded file should be saved. You may give a directory name or a file name.Relative paths will be resolved relative to WorkingDirectory.
- maxWidth (Optional)
- Type: SystemInt32
The Downloaded image will be scaled proportionally to this maximum width. Zero means no constraint. - maxHeight (Optional)
- Type: SystemInt32
The Downloaded image will be scaled proportionally to this maximum height. Zero means no constraint. - overWrite (Optional)
- Type: SystemBoolean
If set to true any existing file at the given path will be overwritten. If set to false a unique name such as "file(1).html" will be created in the case of a naming conflict. - identity (Optional)
- Type: IronWebScraperHttpIdentity
An HttpIdentity to send the Request. If null, the ChooseIdentityForRequest method will be used to find a suitable identity.
Return Value
Type: StringThe file path (relative to WorkingDirecory) which the image will be saved to.
