Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. thumb.db file is not updating itself

thumb.db file is not updating itself

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shoaib Hussain
    wrote on last edited by
    #1

    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-<>-

    S 1 Reply Last reply
    0
    • S Shoaib Hussain

      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-<>-

      S Offline
      S Offline
      Steven J Jowett
      wrote on last edited by
      #2

      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 :- ![](Thumbnail.aspx?w=100&f=myimage.jpg) 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 -------------

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups