String strOutPath = "";
ArrFilePath = myCommonMethod. UploadPic (Files, "/UpLoads/UpPicture /");
This. GetThumbnailImage (120,150,100, System. IO. Path. GetFileName (arrFilePath [0]. ToString (), out strOutPath );
// Create a thumbnail Function
/// <Summary>
///
/// </Summary>
/// <Param name = "width"> thumbnail width </param>
/// <Param name = "height"> thumbnail height </param>
/// <Param name = "level"> scale down </param>
/// <Param name = "file_id"> file name </param>
Public void GetThumbnailImage (int width, int height, int level, string file_id, out string strOutParam)
{
String newfile = Request. PhysicalApplicationPath + "/UpLoads/UpPicture/" + "top _" + file_id;
System. Drawing. Image oldimage = System. Drawing. Image. FromFile (Request. PhysicalApplicationPath + "/UpLoads/UpPicture/" + file_id );
System. Drawing. Image thumbnailImage = oldimage. GetThumbnailImage (width, height, new System. Drawing. Image. GetThumbnailImageAbort (ThumbnailCallback), IntPtr. Zero );
Bitmap output = new Bitmap (thumbnailImage );
// Processing JPG Quality Functions
ImageCodecInfo [] codecs = ImageCodecInfo. GetImageEncoders ();
ImageCodecInfo ici = null;
Foreach (ImageCodecInfo codec in codecs)
{
If (codec. MimeType = "image/jpeg ")
{
Ici = codec;
}
}
EncoderParameters ep = new EncoderParameters ();
Ep. Param [0] = new EncoderParameter (Encoder. Quality, (long) level );
Output. Save (newfile, ici, ep );
// Output parameters
StrOutParam = newfile. Substring (newfile. LastIndexOf ("/") + 1 );
// Release all objects used
Ep. Dispose ();
Output. Dispose ();
Oldimage. Dispose ();
ThumbnailImage. Dispose ();
/// Delete the source Image
// String file_path = "/UpLoads/UpPicture/" + "top _" + file_id;
// UsageIO. DeletePath (Request. PhysicalApplicationPath + "images/article_images/" + file_id );
//// Response. write ("<script> parent. form1.A _ Simg. value = '"+ file_path +"'; location. replace ('upload _ Img. aspx ') </script> ");
}
Bool ThumbnailCallback ()
{
Return false;
}