thumb.db file is not updating itself
-
i am building a image gallery in ASP.NET. All images are placed in a specific folder and i want to show the thumb nails of all those image on the web page. Its all working well. Means that my page is displaying the thumb nails of all images that exists in the folder. The problem arise when i copy the new files in the folder, then the new copied files are not being displayed by thumbs.db file. Thumbs.db file donot update itself when new files are copied in the folder. how i can solve this problem that when ever i delete or copy images in the folder, the thumbs.db file updates itself???????????????
-<>-shoaib-<>-
-
i am building a image gallery in ASP.NET. All images are placed in a specific folder and i want to show the thumb nails of all those image on the web page. Its all working well. Means that my page is displaying the thumb nails of all images that exists in the folder. The problem arise when i copy the new files in the folder, then the new copied files are not being displayed by thumbs.db file. Thumbs.db file donot update itself when new files are copied in the folder. how i can solve this problem that when ever i delete or copy images in the folder, the thumbs.db file updates itself???????????????
-<>-shoaib-<>-
Don't cross post, but to answer your question, I believe you will need to write your own thumbnail generator. Luckly for you, here's one I already done :- Create a new Web Form and call it Thumbnail.aspx Put the following code in the code behind
Partial Class Thumbnail Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Dim oImage As System.Drawing.Image Dim oThumbnail As System.Drawing.Image Dim sServerPath As String Dim sFileName As String Dim iWidth As Int16 Dim iHeight As Int16 sServerPath = AppPath() & Request.QueryString("p") sFileName = Request.QueryString("f") Try oImage = System.Drawing.Image.FromFile(sFileName) Catch ex As Exception oImage = System.Drawing.Image.FromFile(AppPath() & "Images\error.gif") End Try If Request.QueryString("w") = Nothing And Request.QueryString("h") Is Nothing Then iWidth = oImage.Width iHeight = oImage.Height ElseIf Not Request.QueryString("w") Is Nothing And Not Request.QueryString("h") Is Nothing Then iWidth = Request.QueryString("w") iHeight = Request.QueryString("h") ElseIf Not Request.QueryString("w") Is Nothing Then iWidth = Request.QueryString("w") iHeight = oImage.Height / (oImage.Width / iWidth) ElseIf Not Request.QueryString("h") Is Nothing Then iWidth = oImage.Width / (oImage.Height / iHeight) End If oThumbnail = oImage.GetThumbnailImage(iWidth, iHeight, Nothing, System.IntPtr.Zero) Response.ContentType = "image/jpeg" oThumbnail.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) oImage.Dispose() oThumbnail.Dispose() Catch ex As System.Exception 'Your error handling here End Try End Sub End Class
To use the Thumbnail.aspx simply call into from the webpage you wish the thumbnail to appear like so :-
The w parameter represents the width of the thumbnail, you call also use a h parameter for the height or combine the two. The f parameter is path to the image.Steve Jowett -------------