We have an old site that we can't get into anymore and want to save the images for our new site. Yes, we can do a right-click and save as but this could take some time. We have the full url path stored in a database and can get access to that. I am just wondering if anyone knows of any asp.net code that will allow use to quickly save these.
I originally found some code by Karl Moore that does a nice job of viewing an image as a thumbnail but also only works if file is on the server. (posting his code below)
I guess either way would work if I can get to work.
Thanks in advance.
Karls code
VB Code:
<% ' Initialize objects Dim objImage, objThumbnail As System.Drawing.Image Dim strServerPath, strFilename As String Dim shtWidth, shtHeight As Short ' Get image folder path on server - use "\" string if root strServerPath = Server.MapPath("images\") ' Retrieve name of file to resize from query string strFilename = strServerPath & Request.QueryString("filename") ' Retrieve file, or error.gif if not available Try objImage = objImage.FromFile(strFilename) Catch objImage = objImage.FromFile(strServerPath & "error.gif") End Try ' Retrieve width from query string If Request.QueryString("width") = Nothing Then shtWidth = objImage.Width ElseIf Request.QueryString("width") < 1 Then shtWidth = 100 Else shtWidth = Request.QueryString("width") End If ' Work out a proportionate height from width shtHeight = objImage.Height / (objImage.Width / shtWidth) ' Create thumbnail objThumbnail = objImage.GetThumbnailImage(shtWidth, _ shtHeight, Nothing, System.IntPtr.Zero) ' Send down to client Response.ContentType = "image/jpeg" objThumbnail.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) ' Tidy up objImage.Dispose() objThumbnail.Dispose() %>
To call this:
http://www.url.com/viewthumbnail.asp....jpg&width=250




Reply With Quote