<%@  language="VBSCRIPT" codepage="936" %>
<style type="text/css">
.box1 {
border:0px #cccccc solid;
height:440px;
position:relative;

}
.box2 {
border-top:1px #cccccc solid;
background:#f2f6fb;
position:absolute;
bottom:123px;
left: 404px;
height: 40px;
width: 366px;
}
</style>
<% 
Response.Expires = 0
if request.QueryString("action")="delpic" then
set fso=server.CreateObject("Scripting.FileSystemObject")
fso.deletefile server.mappath(request.QueryString("tmpic"))
set fso=nothing
response.write("OK!文件已经删除!")
%>
<div>
    窗口将<span style="display: none" id="later">0</span>自动关闭</div><script>
function a(){
if(later.innerText=="-1"){oTimer=null;window.opener=null;window.close();}
}
var oTimer=setInterval("later.innerText=parseInt(later.innerText)-1;a();",10);
</script><%
response.write("<a href='javascript:window.close();'>如果关闭请单击关闭本页</a>")
response.end()
end if
dim lw
Pic = Request("p")
PointX = CInt(Request("x"))
PointY = CInt(Request("y"))
CutWidth = CInt(Request("w"))
CutHeight = CInt(Request("h"))
PicWidth = CInt(Request("pw"))
PicHeight = CInt(Request("ph"))
lw=Request("lw")
sw=CInt(Request("sw"))
sh=CInt(Request("sh"))Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath(Pic)
'缩放切割图片
Jpeg.Width = PicWidth
Jpeg.Height = PicHeight
Jpeg.Crop PointX, PointY, CutWidth + PointX, CutHeight + PointY
 '输出图片'newp=replace(Server.MapPath(Pic),".jpg","_small.jpg")
t=year(now)&day(now)&hour(now)&second(now)
fullpatharr=split(pic,"/")
for i=0 to ubound(fullpatharr)-1
picstr=picstr&fullpatharr(i)&"/"
next
CreateFolder(picstr&"small")
picstr=picstr&"small/"&fullpatharr(ubound(fullpatharr))
fullpath=""&replace(picstr,Right(picstr,4),"_"&lw&Right(picstr,4))
response.Write(fullpath)
Jpeg.Width =sw
Jpeg.Height =shJpeg.save server.MapPath(fullpath)
'Response.ContentType = "image/jpeg"
'Jpeg.SendBinary
'nowname=replace(replace(replace(replace(fullpath,"/","-"),".jpg",""),"upimg-",""),"passimg-","")&".jpg"
'Response.Redirect"userico.asp?Filename="&fullpath
'Response.Write"<script language='javascript'>alert('成功处理缩略图!');</sc"&"ript>"
%>
<%Sub CreateFolder(strFolder)
          '首选判断要建立的文件夹是否已经存在
          Dim strTestFolder, objFSO
          strTestFolder = Server.Mappath(strFolder)
          Set objFSO = CreateObject("Scripting.FileSystemObject")
          ' 检查文件夹是否存在
          If objFSO.FolderExists(strTestFolder) Then
response.write "该文件夹已经存在!"
          Else
strTestFolder = Server.Mappath(strFolder)
Set objFSO = CreateObject("Scripting.FileSystemObject")
' 建立文件夹
objFSO.CreateFolder(strTestFolder)
Set objFSO = Nothing
          End If
End Sub%>
<center>
    图片已经处理
    <div>
        <br />
        窗口将<span style="display: none" id="later">0</span>自动关闭</div>    <script>
function a(){
if(later.innerText=="-1"){oTimer=null;window.opener=null;window.close();}
}
var oTimer=setInterval("later.innerText=parseInt(later.innerText)-1;a();",10);    </script></center>
<%
Response.End()
%>
<table align="right" width="100%" border="0">
    <tr>
        <td>
            <img name="aaa" src="<%=fullpath%>" alt="<%=nowname%>" />
            <input id="picpath" type="text" style="display: none" value="<%=fullpath%>" />
        </td>
    </tr>
    <tr>
        <td>
            <table width="100%" border="0">
                <tr>
                    <td>                        <script>
function xcopyf(){
         var obj=document.getElementById("msg21");
          window.clipboardData.setData("text",obj.innerText);
    alert('成功复制!');
}
                        </script>                        <div align="center">
                            路径<input type="button" onclick="xcopyf()" value="复制" />: <span id="msg21" style="font-size: 14px;
                                font-weight: bold; color: #0033CC">
                                <%=fullpath%>
                            </span>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div align="center">
                            <a href="imgdo.asp?action=delpic&tmpic=<%=fullpath%>" title="删除!不提示确认!" onclick=""><font
                                color='#FF0000'>删除文件</font></a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="javascript:window.close();"
                                    title="保存图片!并关闭本页!">保存关闭</a></div>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

解决方案 »

  1.   

    http://forum.csdn.net/SList/ASP/ASP专区
      

  2.   

    错误是:
    错误类型:
    Server 对象, ASP 0177 (0x800401F3)
    无效的类别字符串 
    /cutimg.asp, 第 829 行
    浏览器类型:浏览器类型:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; 360SE) 网页:
    GET /cutimg.asp 时间:
    2010年10月27日, 10:06:00 
      

  3.   

    用缩略图水印组件:缩略图水印组件wsImage3.5 
    wsImage是一个高效率生成缩略图和为图片添加水印的COM组件。源图片支持多种图片格式,比如BMP,JPG,GIF等。组件提供四种生存缩略图的方式,方便各种需要。组件同时具有图片裁减功能,能够获取图片尺寸。组件支持文字水印和图片水印,文字水印可设定透明度、阴影及阴影模糊,自定义字体、颜色、旋转角度等。图片水印也支持透明度。支持图片任意角度旋转。组件由顺代码实现,无须任何运行库,无须GDI+库,发布和布署方便。性能极为稳定,消耗系统资源少。http://www.wave12.com/home.asp