/**/ /// <Summary>
/// Use aspjpg to generate a thumbnail
/// </Summary>
/// <Param name = "originalpicpath"> Original Image path, virtual path, such as "images/aa.jpg" </Param>
/// <Param name = "thumbnailpicpath"> Thumbnail storage path, such as "images /" </Param>
/// <Param name = "maxwidth"> Max thumbnail width </Param>
/// <Param name = "maxheight"> Maximum thumbnail height </Param>
/// <Returns> Returns the virtual path of the thumbnail file. </Returns>
Public String Thumbpic ( String Originalpicpath, String Thumbnailpicpath, Int Maxwidth, Int Maxheight)
{
Aspjpeglib. iaspjpeg objjpeg = New Aspjpeglib. aspjpeg ();
// Compute path to source Image
String strpath = Server. mappath (originalpicpath );
// Open source Image
Objjpeg. Open (strpath );
Thumbnailpicpath + = System. datetime. Now. Date. to1_datestring () + " . " + System. datetime. Now. Minute. tostring () + " . " + System. datetime. Now. Second. tostring () + " . " + System. datetime. Now. millisecond. tostring () + " . " + Objjpeg. originalformat;
// Ensure that the source image is scaled proportionally to the thumbnail under the source image.
Decimal Width = 0 ;
Decimal Height = 0 ;
If (Objjpeg. originalwidth < Objjpeg. originalheight)
{
Height=Maxheight;
Width=Convert. toint32 (maxheight*Objjpeg. originalwidth/Objjpeg. originalheight );
}
Else
{
Width=Maxwidth;
Height=Convert. toint32 (maxwidth*Objjpeg. originalheight/Objjpeg. originalwidth );
}
Objjpeg. Width = Convert. toint32 (width );
Objjpeg. Height = Convert. toint32 (height );
// Create thumbnail and save it to disk
Objjpeg. Save (server. mappath (thumbnailpicpath ));
Return Thumbnailpicpath;
}
Aspjpeg download