Results 1 to 2 of 2

Thread: grab image from internet

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    17

    Post

    Given a web address which contain an image (different image on everyday). Is it possible to download the image and save to a specific location on harddrive?
    Thanks.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    yes!

    put an internet transfer control and a command button onto a form and paste this in:

    (it's a picture of me)

    Code:
    Private Sub Command1_Click()
    Dim localFile As String
    Dim remoteFile As String
    Dim fNum As Long
    Dim b() As Byte
    
    remoteFile = "http://graffiti.virgin.net/dms.mbs/images/mark.jpg"
    localFile = "C:\temp\mark.jpg"
        
       
      fNum = FreeFile
        ' Retrieve the file as a byte array.
        b() = Inet1.OpenURL(remoteFile, icByteArray)
        
        Open localFile For Binary As #fNum
        Put #fNum, , b()
        Close #fNum
        MsgBox "Done"
    End Sub
    ------------------
    Mark Sreeves
    Analyst Programmer

    Mark.Sreeves@Softlab.co.uk
    A BMW Group Company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width