ÔÚASP.NETÖÐÉÏ´«Í¼Æ¬²¢Éú³ÉËõÂÔͼ
private void btnUploadPicture_Click(object sender, System.EventArgs e)
{
//¼ì²éÉÏ´«ÎļþµÄ¸ñʽÊÇ·ñÓÐЧ
if(this.UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < 0)
{
Response.Write("ÉÏ´«Í¼Æ¬¸ñʽÎÞЧ£¡");
return;
}
//Éú³ÉÔͼ
Byte[] oFileByte = new byte[this.UploadFile.PostedFile.ContentLength];
System.IO.Stream oStream = this.UploadFile.PostedFile.InputStream;
System.Drawing.Image oImage = System.Drawing.Image.fromStream(oStream);
int oWidth = oImage.Width; //Ôͼ¿í¶È
int oHeight = oImage.Height; //Ôͼ¸ß¶È
int tWidth = 100; //ÉèÖÃËõÂÔͼ³õʼ¿í¶È
int tHeight = 100; //ÉèÖÃËõÂÔͼ³õʼ¸ß¶È
//°´±ÈÀý¼ÆËã³öËõÂÔͼµÄ¿í¶ÈºÍ¸ß¶È
if(oWidth >= oHeight)
{
tHeight = (int)Math.Floor(Convert.ToDouble(oHeight) * (Convert.ToDouble(tWidth) / Convert.ToDouble(oWidth)));
}
else
{
tWidth = (int)Math.Floor(Convert.ToDouble(oWidth) * (Convert.ToDouble(tHeight) / Convert.ToDouble(oHeight)));
}
//Éú³ÉËõÂÔÔͼ
Bitmap tImage = new Bitmap(tWidth,tHeight);
Graphics g = Graphics.fromImage(tImage);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //ÉèÖøßÖÊÁ¿²åÖµ·¨
g.SmoothingMode = System.Drawin
Ïà¹ØÎĵµ£º
½ñÌìÒª×öºÃÒ»µãµÄµÇ½¿ò½á¹û¾ÍÏë×ö¸öÈ«¾ÖµÄÅжÏÊÇ·ñÓû§ËùÒÔÕÒÁËÒ»ÏÂÎÄÕÂ
ÕâÀïÖ¸µÄµ¥µã£¬·ºÖ¸ÔÚWEB·þÎñ¶Ë£¬Ò»¸öÕË»§Í¬Ò»Ê±¿ÌÖ»ÄÜ´æÔÚÒ»¸öƱ¾Ý£¡
´ó¼Ò¿ª·¢ÖпÉÄܶ¼Åöµ½µÄÒ»¸öÎÊÌ⣬Ôõôʹͬһ¸öÓû§£¬ÔÚͬһʱ¼äÄÚÖ»ÔÊÐíµÇ¼һ´Î¡£
ºÜ¶àÈ˶¼»áÏëµ½ÔÚÊý¾Ý¿âÖÐÓÃÒ»¸ö±êʶ×ֶΣ¬µÇ¼½øÈ¥ÖÃ1,Í˳öÖÃ0,µÇ¼ʱÅжÏÕâ¸ö×ֶΣ¬Èç¹ ......
ÔÚGlobal.asaxÖе¼ÈëÃüÃû¿Õ¼ä
<%@Global ...
<%@Import Namespace= "System.Data " %>
<%@Import& ......
AJAXÊÇAsynchronous JavaScript and XMLËõд¡£Õâ¸ö¸ÅÄî´ú±íµÄÊÇÒ»ÖÖ¼¼Êõ£¬µ±ÄúÔÚ˵“ÎÒÔÚÏîÄ¿ÖÐʹÓÃÁËAJAX¼¼Êõʱ”£¬Ö»ÊÇ´ú±íÁËÄúʹÓÿͻ§¶ËXMLHttpRequest¶ÔÏóÓë·þÎñÆ÷¶Ë½øÐÐÒ첽ͨÐÅ¡£²»¹ýÒòΪËæ×ÅAJAX¼¼ÊõµÄÔËÓÃÍùÍù»á´øÀ´·á¸»µÄ¿Í»§¶ËЧ¹û£¬Òò´Ë¶ÔAJAX¼¼ÊõµÄ¹ãÒåÀí½âÒ²¿ÉÒÔÈÏΪÕâÊÇÒ»ÖÖ²Ù×÷ ......
1.·ûºÅ“/”Ö¸³ÌÐòÔËÐÐËùÔÚ¸ùĿ¼£¬¼´IIsËùÔÚĿ¼¡£
Èç¹ûiisËùÔÚĿ¼Ϊ£ºd:\programs
½â¾ö·½°¸Îªd:\programs\d
Íøվ·¾¶Îª£ºd:\programs\d\web\
·ûºÅ“/”´ú±íµÄÊÇ£ºd:\programs£¬²»¹ÜÄãµÄÍøվǰÃæÓжàÉÙ¼¶£¬¶¼Ó¦¸Ã×÷Ϊһ¸öÕûÌå¡£
2.·ûºÅ“~/”£¬ÔòÊÇÖ¸ÍøÕ¾ËùÔÚ¸ùĿ¼¡£¼´d:\programs\ ......