ASP.NET(C#)ͼƬÉÏ´«Ñ¹Ëõ³ÉËõÂÔͼµÄ´úÂë
// °´Ä£°æ±ÈÀýÉú³ÉËõÂÔͼ£¨ÒÔÁ÷µÄ·½Ê½»ñÈ¡Ô´Îļþ£©
//Éú³ÉËõÂÔͼº¯Êý
//˳Ðò²ÎÊý£ºÔ´Í¼ÎļþÁ÷¡¢ËõÂÔͼ´æ·ÅµØÖ·¡¢Ä£°æ¿í¡¢Ä£°æ¸ß
//×¢£ºËõÂÔͼ´óС¿ØÖÆÔÚÄ£°æÇøÓòÄÚ
public static void MakeSmallImg(System.IO.Stream fromFileStream,string fileSaveUrl,System.Double templateWidth,System.Double templateHeight)
{
//´ÓÎļþÈ¡µÃͼƬ¶ÔÏ󣬲¢Ê¹ÓÃÁ÷ÖÐǶÈëµÄÑÕÉ«¹ÜÀíÐÅÏ¢
System.Drawing.Image myImage = System.Drawing.Image.fromStream(fromFileStream,true);
//ËõÂÔͼ¿í¡¢¸ß
System.Double newWidth = myImage.Width , newHeight = myImage.Height;
//¿í´óÓÚÄ£°æµÄºáͼ
if(myImage.Width>myImage.Height || myImage.Width==myImage.Height)
{
if(myImage.Width > templateWidth)
{
//¿í°´Ä£°æ£¬¸ß°´±ÈÀýËõ·Å
newWidth = templateWidth;
newHeight = myImage.Height * (newWidth/myImage.Width);
}
}
//¸ß´óÓÚÄ£°æµÄÊúͼ
else
{
if(myImage.Height > templateHeight)
{
//¸ß°´Ä£°æ£¬¿í°´±ÈÀýËõ·Å
newHeight = templateHeight;
newWidth = myImage.Width * (newHeight/myImage.Height);
}
}
//È¡µÃͼƬ´óС
System.Drawing.Size mySize = new Size((int)newWidth,(int)newHeight);
//н¨Ò»¸öbmpͼƬ
System.Drawing.Image bitmap = new System.Drawing.Bitmap(mySize.Width,mySize.Height);
//н¨Ò»¸ö»°å
System.Drawing.Graphics g = System.Drawing.Graphics.fromImage(bitmap);
//ÉèÖøßÖÊÁ¿²åÖµ·¨
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
//ÉèÖøßÖÊÁ¿,µÍËٶȳÊÏÖƽ»¬³Ì¶È
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//Çå¿Õһϻ²¼
g.Clear(Color.White);
//ÔÚÖ¸¶¨Î»Öûͼ
g.DrawImage(myImage , new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height) ,
new System.Drawing.Rectangle(0, 0, myImage.Width,myImage.Height) ,
System.Drawing.GraphicsUnit.Pixel);
///ÎÄ×Öˮӡ
//System.Drawing.Graphics G=System.Drawing.Graphics.fromImage(bitmap);
//System.Drawing.Font f=new Font("ËÎÌå",10);
//System.Drawing.Brush b=new SolidBrush(Color.Black);
//G.DrawString("myohmine",f,b,10,10);
//G.Dispose();
///ͼƬˮӡ
//System.Drawing.Image copyImage = System.Drawing.Imag
Ïà¹ØÎĵµ£º
Step 1£ºÐ½¨Êý¾Ý¿â(¿â£ºMyForms £»±í£ºusers £»×ֶΣºID£¬userName, userPwd)£»
Step 2£ºÐ½¨ÍøÕ¾£¬web.config µÄÎļþÈ«²¿´úÂëÈçÏ£º
web.config µÄÈ«²¿´úÂë
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
......
(1) ASP.NET µÄÊý¾ÝÑéÖ¤¿Õ¼þRegularExpressionValidator ʵÏÖÑéÖ¤FileUpLoadÉÏ´«ÎļþµÄÀàÐÍ
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileUpload1"
ErrorMessage="¸ñʽ²»×¼È·£¬Ö»ÄÜ(.jpg|.JPG|.gif|.G ......
public class SqlCheck
{
public SqlCheck()
{
//
// TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼
//
}
public SqlConnection oconn()
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["StudyConnectionString"] ......
FCKeditor ÔÚASP.Net ÖеÄʹÓÃ˵Ã÷
[ 2008-7-23 23:41:00 | By: »ª×Ó ]
2
ÍƼö
FCKeditor ÊÇÒ»¸öÔËÐÐÔÚä¯ÀÀÆ÷É쵀 Java Ó¦ÓóÌÐò¡£Ëû¿ÉÒÔ²»ÒÀÀµÈκηþÎñÆ÷¶ËÓïÑÔÔËÐС£²»¹ý£¬¸üºÃµÄʹÓ÷½·¨ÊÇÄãʹÓÃÒ»ÖÖ·þÎñÆ÷¶ËÓïÑÔÀ´µ÷ÓÃËû¡£
ÔÚASP.Net ÖУ¬ÓÐÒ»¸öÏֳɵŤ¾ß°ü¿ÉÒÔÈÃÄã°Ñ FCKeditor ×÷Î ......
ÔÚasp.net¿ª·¢ÖУ¬¾³£»áÓõ½ºǫ́ºÍǰ̨µÄ½»»¥£¬¾Í´Ë×ܽáÁËÒ»µãc#ºÍjavascriptÏ໥²Ù×÷µÄ·½·¨
1.ÔÚºǫ́c#´úÂëÖе÷ÓÃjacascriptµÄ·½·¨
javascript´úÂ룺
<script type="text/javascript" language="javascript">
function test()
{
alert("oec2003");
return false;
}
</s ......