|
| |
|
|
samfreedom
Posts: 39 Joined: 11/6/2004 Status: offline
|
Save Images from External Web Page Question - 10/27/2008 5:23:59
I am wondering how to get web page images, as part of an external web page, to all save along with the web page I'm trying to save. For example, if I simply "open a new blank page" and, instead of choosing a file, I put in a web address. It loads the page and graphics so I can see everything in my design tab. When I hit SAVE AS and attempt to save, IT USED TO also save all the graphics associated with that page at the same time, asking me if I want to pick a different folder for them. However, after a recent reinstall, I now do the same thing but when I go to SAVE AS, and save it, it doesn't save the graphics, only the site. The graphics still show up in design and preview because it's using the address at which the graphics were hosted. I would rather download the graphics simultaneously and host them myself. In case anyone is wondering, I am talking about non-copyright graphics... perhaps a car lover's page with dozens of generic shots of, for example, Volkswagon, etc. I don't want to go in and "SAVE AS" each individual image. And I certainly don't want to stay linked to them because that WOULD be stealing bandwidth. I just want someone's wise counsel as to how to get the graphics to all save at once external page is loaded and saved. Hope someone understands, Bes wishes, Sam
|
|
|
|
treetopsranch
Posts: 1648 From: Cottage Grove, OR, USA Status: offline
|
RE: Save Images from External Web Page Question - 10/27/2008 11:31:51
I just did a test using FF (using 'Save as')and it saved all of the pictures so what browser were you using?
_____________________________
Don from TreeTops Ranch, Oregon "I've got a taste for quality and luxury"
|
|
|
|
samfreedom
Posts: 39 Joined: 11/6/2004 Status: offline
|
RE: Save Images from External Web Page Question - 10/27/2008 14:47:44
quote:
ORIGINAL: treetopsranch I just did a test using FF (using 'Save as')and it saved all of the pictures so what browser were you using? Tailside, thanks for the heads up... some of these, for example, are generic automobile photos. If a site has like 50 Volkswagon photos, for example, I don't want to have to d/l each by hand... but I thank you for your concern. Treetopsranch... seems I got all the pics to download automatically when I savedas HTML FILES... when I tried to save as WEBPAGE, they did not. I'm using latest Firefox, but I wonder why I had to do it that way because I used to never have to... Thanks to all... Sam
|
|
|
|
orthelius
Posts: 1 Joined: 1/25/2009 Status: offline
|
RE: Save Images from External Web Page Question - 1/25/2009 12:20:31
I had to solve the same problem and after googleling for a while i came up with te following solution: I do my programming in Common.ASP, but the solution is also possible in PHP i think. Here is the routine:
function SaveExternalImage(fromUrl, ToPath, ToName)
on error resume next
if ToName="" then
' ----- if you want the original filename
ToFile=right(fromUrl,len(fromUrl)-instrrev(fromUrl,"/"))
else
'----- if you use your own ToName use original extension
FileExt=right(fromUrl,len(fromUrl)-instrrev(fromUrl,".")+1)
ToFile=ToName&FileExt
end if
Set oImageRequest = Server.CreateObject("Msxml2.SERVERXMLHTTP")
oImageRequest.Open "GET", fromUrl , false
oImageRequest.send
If Err.Number = 0 then
Set adoStream = Server.CreateObject("ADODB.Stream")
adoStream.Mode = 3 ' read write
adoStream.Type = 1 ' adTypeBinary
adoStream.Open()
adoStream.write oImageRequest.responseBody
adostream.SaveToFile ToPath&ToFile,2
adostream.Flush
SaveExternalImage=ToFile
else
SaveExternalImage=""
end if
end function
use it like this
imgUrl="http://www.google.com/images/nav_logo4.png"
cachedir="c:\webroot\images\upload\cache\"
name="myfilename" 'dont use any extension it comes from the original file
newpicture= SaveExternalImage(imgUrl, cachedir, name)
if newpicture<>"" then
response.write "<img src='/images/upload/cache/"&newpicture&"' >"
else
response.write "error or no picture found"
end if
the output wil be <img src='/images/upload/cache/myfilename.png'> i use my own filename based on the description in my database, but you can easily use the original filename of course
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|