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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top