<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpPic.aspx.cs" Inherits="TopWinCMS.WebUI.Admin.Window.UpPic" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>上传图片</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <meta content="no-cache" http-equiv="Pragma" />

    <script language="javascript" src="../TopWin.js" type="text/javascript"></script>

    <link href="../Style.css" rel="stylesheet" type="text/css" />

    <script language="javascript" src="../../Images/skysoft.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
    var flag=false;
    function DrawImage(ImgD)
    {
	    var image=new Image();
	    image.src=ImgD.src;
	    if(image.width>0 && image.height>0)
	    {
		    flag=true;
		    if(image.width/image.height>= 120/80)
		    {
			    if(image.width>120)
			    {
				    ImgD.width=120;
				    ImgD.height=(image.height*120)/image.width;
			    }
			    else
			    {
				    ImgD.width=image.width;
				    ImgD.height=image.height;
			    }
			    ImgD.alt=image.width+"×"+image.height;
		    }
		    else{
			    if(image.height>80){
				    ImgD.height=80;
				    ImgD.width=(image.width*80)/image.height;
			    }
			    else{
				    ImgD.width=image.width;
				    ImgD.height=image.height;
			    }
			    ImgD.alt=image.width+"×"+image.height;
		    }
	    }
    }

    function FileChange(Value)
    {
	    flag=false;
	    document.all.uploadimage.width=10;
	    document.all.uploadimage.height=10;
	    document.all.uploadimage.alt="";
	    document.all.uploadimage.src=Value;
    }
 
	function ClickRetrun( v )
	{
	    window.returnValue = v;
	    window.close();
	}
 
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <table>
        <tr>
            <td class="RowStyle">
                上传缩略图：
            </td>
            <td>
                <asp:FileUpload ID="FileUpload1" runat="server" Width="322px" onchange="javascript:FileChange(this.value);" />
                &nbsp;&nbsp;&nbsp;
                <asp:Button ID="BT_UpLoad" runat="server" OnClick="BT_UpLoad_Click" Text="上传" CssClass="btn" />
                <br />
                <img id="uploadimage" height="10" width="10" alt="" src="" onload="javascript:DrawImage(this);" />
            </td>
        </tr>
        </table>
   
    </form>
</body>
</html>
