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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to show image into thumbnail [modified]

how to show image into thumbnail [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasearchitecturehelptutorial
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
    surshbabuk
    wrote on last edited by
    #1

    hi, we are creating image library using c# can u plz help me about the topic................. Uploading(htmlbrows control) Images to a Database, and Retrieving Images from a Database into thumbnail images.All thumbnail images shown in the same page uasing one control i.e,(whenever i click the preview button). we are using 3-tier architecture suresh babu.k -- modified at 0:40 Sunday 18th June, 2006

    M 1 Reply Last reply
    0
    • S surshbabuk

      hi, we are creating image library using c# can u plz help me about the topic................. Uploading(htmlbrows control) Images to a Database, and Retrieving Images from a Database into thumbnail images.All thumbnail images shown in the same page uasing one control i.e,(whenever i click the preview button). we are using 3-tier architecture suresh babu.k -- modified at 0:40 Sunday 18th June, 2006

      M Offline
      M Offline
      mnaveed
      wrote on last edited by
      #2

      try this public static Bitmap CreateThumbnail(string lcFilename,int lnWidth, int lnHeight) { System.Drawing.Bitmap bmpOut = null; try { Bitmap loBMP = new Bitmap(lcFilename); ImageFormat loFormat = loBMP.RawFormat; decimal lnRatio; int lnNewWidth = 0; int lnNewHeight = 0; //*** If the image is smaller than a thumbnail just return it if (loBMP.Width < lnWidth && loBMP.Height < lnHeight) return loBMP; if (loBMP.Width > loBMP.Height) { lnRatio = (decimal) lnWidth / loBMP.Width; lnNewWidth = lnWidth; decimal lnTemp = loBMP.Height * lnRatio; lnNewHeight = (int)lnTemp; } else { lnRatio = (decimal) lnHeight / loBMP.Height; lnNewHeight = lnHeight; decimal lnTemp = loBMP.Width * lnRatio; lnNewWidth = (int) lnTemp; } // System.Drawing.Image imgOut = // loBMP.GetThumbnailImage(lnNewWidth,lnNewHeight, // null,IntPtr.Zero); // *** This code creates cleaner (though bigger) thumbnails and properly // *** and handles GIF files better by generating a white background for // *** transparent images (as opposed to black) bmpOut = new Bitmap(lnNewWidth, lnNewHeight); Graphics g = Graphics.FromImage(bmpOut); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; g.FillRectangle( Brushes.White,0,0,lnNewWidth,lnNewHeight); g.DrawImage(loBMP,0,0,lnNewWidth,lnNewHeight); loBMP.Dispose(); } catch { return null; } return bmpOut; } } Nav.

      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