Hi Guys,
I am currently saving images from a webpage via the following method:
Dim WinHttpReq As Object
Dim Network_path As String
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
Network_path = ThisWorkbook.Path & "\Staff_Images"
Image_Source = "http://profiles.website.com/User%20Photos/Profile%20Pictures/" & Staff_ID & "_LThumb.jpg"
If Dir(Network_path, vbDirectory) = "" Then MkDir Network_path
'WinHttpReq.Open "GET", Image_Source, False, "username", "password"
'Debug.Print "Sending image request for staff member : T" & Staff_Id
WinHttpReq.Open "GET", Image_Source, False
WinHttpReq.send
Image_Source = WinHttpReq.responseBody
If WinHttpReq.Status = 200 Then
'Debug.Print "Success"
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
oStream.SaveToFile Network_path & "\" & Staff_ID & ".jpg", 2 ' 1 = no overwrite, 2 = overwrite
oStream.Close
I was wondering, is there any way to save the image with set dimensions? ALL of the images that i wish to download are 140px x 144px however I want to store in addition to the original image, a 35px x 36px (1/4 ratio).
I am doing this so that I can populate an image list that can be referenced by both listview and treeview controls.
Kind regards
Jordan
Bookmarks