//Generate thumbnail function
//Sequence parameters: source image file flow, thumbnail storage address, template width, template height
//Note: The thumbnail size is controlled within the template area
public static void MakeSmallImg( fromFileStream, string fileSaveUrl, templateWidth, templateHeight)
{
//Get picture objects from the file and use the color embedded in the stream to manage information
myImage = (fromFileStream, true);
//Thumbnail width and height
newWidth = , newHeight = ;
//The horizontal picture with width larger than the template
if ( > || == )
{
if ( > templateWidth)
{
//Wide by template, high scale
newWidth = templateWidth;
newHeight = * (newWidth / );
}
}
//The vertical chart that is higher than the template
else
{
if ( > templateHeight)
{
//High is scaled by template, width is scaled by scale
newHeight = templateHeight;
newWidth = * (newHeight / );
}
}
//Get the image size
mySize = new Size((int)newWidth, (int)newHeight);
// Create a new bmp image
bitmap = new (, );
// Create a new drawing board
g = (bitmap);
//Set high-quality interpolation method
= .;
//Set high quality and low speed to show smoothness
= .;
//Clear the canvas
();
//Draw a picture at the specified location
(myImage, new (0, 0, , ),
new (0, 0, , ),
);
/// Text watermark
// G=(bitmap);
// f=new Font("Song style",10);
// b=new SolidBrush();
//("myohmine",f,b,10,10);
//();
///Picture watermark
// copyImage = (("pic/"));
//Graphics a = (bitmap);
//(copyImage, new Rectangle(,,, ),0,0, , , );
//();
//();
//();
//Save thumbnail
(fileSaveUrl, );
();
();
();
}