How to automatically save the entire web page *with images* 
Author Message
 How to automatically save the entire web page *with images*
All of the methods I've seen so far don't save the images
along with the rest of the page.

AFAIK URLDownloadToFile API doesn't work.

I've looked all over and there are tons of requests for
this in the Usenet groups...

It's so odd that at the end of  "Q244757 HOWTO: Download a
File Without Prompting"

it says "Note that when downloading HTML files, embedded
content like images and objects will not be downloaded."

I am the only one who likes the luxury of downloading a
complete file?



Sat, 24 Dec 2005 10:44:11 GMT  
 How to automatically save the entire web page *with images*

I am the only one who likes the luxury of downloading a
complete file?
=> The file is complete...the images etc are as "external resources".

Anyhow...
Here are 2 basic options:
1) Download the images as well and update the IMG tags on your local
copy.

2) Update the IMG tags etc to use absolute URLs.

-------------
It's a long way to the top (if you wanna be a developer)

-Mathias->

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 24 Dec 2005 20:09:15 GMT  
 How to automatically save the entire web page *with images*
Hi Brog,

Here is a workaround. To use the workaround you may first reference to
"Microsoft HTML Object Library" and add the component of "Microsoft
Internet Controls". Moreover, a procreated folded "c:\images" is necessary.

Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String,
ByVal _
    szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long)
As Long

Const BASE_DIR = "C:\images\"

Private Sub Form_Load()
    wbMain.Navigate "http://msdn.microsoft.com/ie"
End Sub

Private Sub wbMain_DocumentComplete(ByVal pDisp As Object, URL As Variant)

    Dim collImages As IHTMLElementCollection
    Dim img As IHTMLImgElement
    Dim strFileName As String
    Dim strExtension As String
    Dim lResult As Long
    Dim i As Long
    Dim nAnomalies As Long

    Set collImages = pDisp.Document.getElementsByTagName("IMG")

    For i = 0 To collImages.length - 1
        Set img = collImages.Item(i)
        strFileName = Right(img.src, Len(img.src) - InStrRev(img.src, "/"))
        strExtension = LCase(Right(strFileName, Len(strFileName) -
InStrRev(strFileName, ".")))
        If strExtension = "gif" Or strExtension = "jpg" Or strExtension =
"jpeg" Then
            lResult = URLDownloadToFile(0, img.src, BASE_DIR & strFileName,
0, 0)
        Else
            ' The file may be dynamically generated or may have
            ' a file name without an extension.  We'll inspect
            ' the mimeType property as a last ditch effort and
            ' invent our own filename.
            If InStr(1, img.mimeType, "GIF", vbTextCompare) Then
                lResult = URLDownloadToFile(0, img.src, BASE_DIR &
"anomaly" & nAnomalies & ".gif", 0, 0)
            ElseIf InStr(1, img.mimeType, "JPG", vbTextCompare) Then
                lResult = URLDownloadToFile(0, img.src, BASE_DIR &
"anomaly" & nAnomalies & ".jpg", 0, 0)
            End If
        End If
        Set img = Nothing
    Next i
    Set collImages = Nothing
End Sub

Here is a helpful link.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwe...
tml/webteam03052001.asp

Regards,

Peter Huang
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

Quote:
>Content-Class: urn:content-classes:message


>Subject: How to automatically save the entire web page *with images*
>Date: Mon, 7 Jul 2003 19:44:11 -0700
>Lines: 16

>MIME-Version: 1.0
>Content-Type: text/plain;
>    charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Thread-Index: AcNE+s/su3qahKidT0W0m7ohSpA8EQ==
>Newsgroups: microsoft.public.vb.6.webdevelopment
>Path: cpmsftngxa09.phx.gbl
>Xref: cpmsftngxa09.phx.gbl microsoft.public.vb.6.webdevelopment:668
>NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
>X-Tomcat-NG: microsoft.public.vb.6.webdevelopment

>All of the methods I've seen so far don't save the images
>along with the rest of the page.

>AFAIK URLDownloadToFile API doesn't work.

>I've looked all over and there are tons of requests for
>this in the Usenet groups...

>It's so odd that at the end of  "Q244757 HOWTO: Download a
>File Without Prompting"

>it says "Note that when downloading HTML files, embedded
>content like images and objects will not be downloaded."

>I am the only one who likes the luxury of downloading a
>complete file?



Sun, 25 Dec 2005 16:34:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Saving web page automatically ????

2. Saving web page with images using the WebBrowser control

3. How to Save Images on Web Page

4. saving an image from a web page to database

5. saving an image on a web page into a database

6. Help saving web page with web control?

7. Automatically inserting content of a web page into word

8. automatically populating information into a web page

9. Automatically retrieve data from a web page

10. automatically installing activex component from web page

11. Automatically Saving Images(gifs) from a web page to a local address.

12. pass a form from web page to web page

 

 
Powered by phpBB® Forum Software