asp.net picture upload to generate thumbnails of attention _ practical skills
Source: Internet
Author: User
Bitmap. Save (Imgpath,imageformat.jpeg);
This is a piece of code to save the thumbnail, where the imageformat.jpeg must not be omitted, even if you save the file is JPG format, it can not be removed. Because if removed, the resulting thumbnail is larger than the original picture!
In addition, Imgpath must be created first, or it will produce a generic error for GDI +.
Path=system.web.httpcontext.current.server.mappath (path);
Use if (! System.IO.Directory.Exists (path)) System.IO.Directiory.CreateDirectory (path);
Generate thumbnails, do not use the Getthumbnailimage method, this method produces a thumbnail image quality is extremely poor, can not be used!
The simple code is as follows:
String Path=system.web.httpcontext.current.server.mappath (strpath);
Sourcepath=system.web.httpcontext.current.server.mappath (SourcePath);
if (! System.IO.Directory.Exists (path)) System.IO.Directory.CreateDirectory (path);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service