熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

上傳圖片並修改其大小(C#)的方法

2013-11-13 10:25:37  來源: .NET編程 

  上傳圖片並修改其大小
  //thefile是一個File Field HTML 控件
  thefilePostedFileSaveAs(SystemWebHttpContextCurrentServerMapPath(temppng));
  MemoryStream MemStream=new MemoryStream();
  SystemDrawingImage imgOutput =SystemDrawingBitmapFromFile(SystemWebHttpContextCurrentServerMapPath(temppng));
  //修改成×大小
  SystemDrawingImage imgOutput=imgOutputGetThumbnailImage(nullIntPtrZero);
  imgOutputSave(SystemWebHttpContextCurrentServerMapPath(imagepng) ImageFormatPng);
  ResponseWrite(thefilePostedFileFileName);
  ResponseWrite(Len:+MemStreamLengthToString());
  imgOutputDispose();
  imgOutputDispose();
  ResponseWrite(上傳成功!);
  ResponseWrite(SystemWebHttpContextCurrentServerMapPath(imagepng));

From:http://tw.wingwit.com/Article/program/net/201311/13582.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.