0

I am usinga piece of code like

string originalfilename = Server.MapPath(" ") + "\\img\\" + file_image.FileName;
string originalrelative = "\\img\\" + file_image.FileName;
file_image.SaveAs(originalfilename);
string thumbfilename = Server.MapPath(" ") + "\\img\\t_" + file_image.FileName;
string thumbrelative = "\\img\\t_" + file_image.FileName;
Bitmap original = new Bitmap(originalfilename);
int squareside = 0;
if (original.Width >= original.Height) { squareside = original.Height; } 
 else { squareside = original.Width; }
Bitmap squareimage = (Bitmap)original.Clone(
    new Rectangle(new Point(0, 0), new Size(squareside, squareside)),
    System.Drawing.Imaging.PixelFormat.DontCare);
Bitmap thumb = (Bitmap)squareimage.GetThumbnailImage(200, 200,
    new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback),
    IntPtr.Zero);
thumb.Save(thumbfilename);
file_original = file_image.PostedFile.FileName;
file_thumb = "t_"+file_image.PostedFile.FileName;

to get thumbnail images of each uploaded picture and I use the thumbnail versions of pictures around the website. How should I manipulate this code to preserve the gif files as animated gif files? When I get thumbnails for animated gifs, this code saves them as normal gifs. Of course bitmap class wouldn't support animated gifs but does .net framework support any alternative?

Uğur Gümüşhan
  • 2,455
  • 4
  • 34
  • 62

0 Answers0