two days back i ask a question for image management, i get some reference that is 4guys the code is working fine i want to store that manged image in a folder but i not understand how can i save, can u help me. this is my code.....
public partial class Default2 : System.Web.UI.Page
{
public bool ThumbnailCallback()
{
return false;
}
protected void Page_Load(object sender, EventArgs e)
{
System.Drawing.Image.GetThumbnailImageAbort dummyCallBack = default(System.Drawing.Image.GetThumbnailImageAbort);
dummyCallBack = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
System.Drawing开发者_JAVA技巧.Image fullSizeImg = default(System.Drawing.Image);
fullSizeImg = System.Drawing.Image.FromFile("C:\\05.jpg");
System.Drawing.Image thumbNailImg = default(System.Drawing.Image);
thumbNailImg = fullSizeImg.GetThumbnailImage(100, 100, dummyCallBack, IntPtr.Zero);
}
}
To save an image to a folder on the server, call image.Save(path)
.
EDIT: You can send a smaller version of an image to the browser like this:
using(Image originalImage = something)
using(Bitmap smallImage = new Bitmap(originalImage, width, height)) {
Stream stream = new MemoryStream();
smallImage.Save(stream);
Response.OutputStream.Write(stream.ToArray(), 0, stream.Length);
}
精彩评论