Forum Moderators: open
My idea(this is how i see it in my mind and hope it helps:
<%
dim urltemp, filename
urltemp = "http://test.com/image.jpg"
filename = right(urltemp,/) 'this would get the image file name
if exists("images/" & filename) then
<img src="images/""" & filename & """ border=0>
else
{get urltemp and save it to the "images/" directory}
<img src="images/""" & filename & """ border=0>
end if
%>
*I don't know how to get the filename or do the image download part of the code to the server.
thanks!
<%Set File = CreateObject("Scripting.FileSystemObject")
ImagePath = "d:\Web\htdocs\imgstore"
ImagePath = ImagePath & "\" & "stock_image_width237_" & RSStock("stock_image_id") & ".jpg"
If File.FileExists(ImagePath) Then %>
<a href="imgview_jpg.asp?stock_image_id=<%=RSStock("stock_image_id")%>">
<IMG alt="Loading..." border=1 SRC="\imgstore\width237\stock_image_width237_<%=RSStock("stock_image_id")%>.jpg" width="237"></a>
<%Else %>
Here's the .NET code I use to download images from another server (it's part of a thumbnail generating script):
Dim filename As String = "http://www.test.com/image.jpg"
Dim req As WebRequest = WebRequest.Create(filename)
req.Method = WebRequestMethods.File.DownloadFile
Dim resp As WebResponse = req.GetResponse
Dim respStream As Stream = resp.GetResponseStream
Dim full As System.Drawing.Image
full = System.Drawing.Image.FromStream(respStream)
full.Save("C:\Inetpub\wwwroot\images\imagefromweb.jpg")
Sorry, but I abandoned classic ASP a long time ago. It's a good idea to start converting your site(s) to .NET anyways.