//http://activedeveloperdk.codeplex.com/
//The MIT License (MIT)
using System;
using System.Drawing.Imaging;
using System.Drawing;
using System.IO;
using System.Configuration;
namespace ActiveDeveloper.Core.Utilities
{
public sealed class GDI
{
///
///
///
///
///
///
/// Name of the created thumbnail. E.g: small_thumb.jpg
public static string CreateThumbnail(string imagePathAndName, int newHeight, int newWidth )
{
using( Bitmap bitmap = new Bitmap( imagePathAndName ) ) {
Image thumbnail = bitmap.GetThumbnailImage( newWidth, newHeight, null, new IntPtr() );
FileInfo fileInfo = new FileInfo( imagePathAndName );
string thumbnailName = ConfigurationManager.AppSettings[ "ThumbnailAbr" ] + fileInfo.Name;
thumbnail.Save( fileInfo.Directory.ToString() + Path.DirectorySeparatorChar + thumbnailName );
return thumbnailName;
}
}
}
}