showing ASP.NET thumbnails

G

Guest

Hello friends, i have a directory in which my uploaded images are stored i
want to create thumnails of these images dynamically and show these thumbnail
how can i do this pls tell me about that.
Thanks
 
J

Juan T. Llibre

Hi, asad,

Here's 3 links to online code for generating thumbnails.

http://www.dotnetjunkies.com/HowTo/C4A2ACC3-C6B4-4E4C-802A-85B8DBEC7F25.dcik

http://authors.aspalliance.com/chrisg/tools/view-image2.asp

http://www.mcse.ms/archive109-2003-11-80290.html

You might also want to download and examine the free
Community Starter Kit. It has a thumbnail-generation module :

http://www.asp.net/StarterKits/DownloadCommunity.aspx?tabindex=0&tabid=1




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
S

Steve C. Orr [MVP, MCSD]

You can resize the image using the GetThumbnailImage method.
Here's more info:
http://msdn.microsoft.com/library/d...emDrawingImageClassGetThumbnailImageTopic.asp

Or maybe you'll find these custom functions useful that I wrote:

public Image DisplaySize(Bitmap bmp)
{
Response.Write(bmp.Width.ToString());
Response.Write(bmp.Height.ToString());
}

//shrink the image proportionately so that neither height nor width is more
than [NewSize] pixels

public System.Drawing.Image ShrinkImage(System.Drawing.Bitmap bmp, int
NewSize)

{

double NewWidth;

double NewHeight;

double ShrinkPercent;

System.Drawing.Image.GetThumbnailImageAbort myCallback =

new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);

if (bmp.Width>bmp.Height)

{

NewWidth=NewSize;

ShrinkPercent=(NewWidth/bmp.Width)*100;

NewHeight=(ShrinkPercent/100)*bmp.Height;

}

else

{

NewHeight=NewSize;

ShrinkPercent=(NewHeight/bmp.Height)*100;

NewWidth=(ShrinkPercent/100)*bmp.Width;

}

System.Drawing.Image myShrunkenImage =
bmp.GetThumbnailImage((int)NewWidth,(int)NewHeight,myCallback,IntPtr.Zero);

return myShrunkenImage;

}

public bool ThumbnailCallback(){return false;}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top