<%
if Thumbok<>0 then
set jpeg = server.createobject("persits.jpeg") 
' 图片所在位置 
path = server.mappath("..\images\proupfile\") &"\"&filename21

' 打开 
jpeg.open path 
If err.number then 
Response.write"打开图片失败,请检查路径！"&path
Response.End() 
End if 
picwidth=webimg9
picheigh=webimg10


'按比例取得缩略图宽度和高度
    Dim n_OriginalWidth, n_OriginalHeight '原图片宽度、高度
    Dim n_BuildWidth, n_BuildHeight '缩略图宽度、高度
    if picwidth> picheight then
    
     n_MaxWidth= int(picwidth)
    else
     n_MaxHeight=int(picheigh)

    end if

    Dim div1, div2
    Dim n1, n2
    n_OriginalWidth = jpeg.originalwidth 
    n_OriginalHeight = jpeg.originalheight
    div1 = n_OriginalWidth / n_OriginalHeight
    div2 = n_OriginalHeight / n_OriginalWidth
    n1 = 0
    n2 = 0
    If n_OriginalWidth > n_MaxWidth Then
        n1 = n_OriginalWidth / n_MaxWidth
    Else
        n_BuildWidth = n_OriginalWidth
    End If
    If n_OriginalHeight > n_MaxHeight Then
        n2 = n_OriginalHeight / n_MaxHeight
    Else
        n_BuildHeight = n_OriginalHeight
    End If
    If n1 <> 0 Or n2 <> 0 Then
        If n1 > n2 Then
            n_BuildWidth = n_MaxWidth
            n_BuildHeight = n_MaxWidth * div2
        Else
            n_BuildWidth = n_MaxHeight * div1
            n_BuildHeight = n_MaxHeight
        End If
    End If

jpeg.width = n_BuildWidth
jpeg.height = n_BuildHeight



' 设置缩略图大小（这里比例设定为50%）






' 保存缩略图到指定文件夹下 
jpeg.save server.mappath("..\images\proupfile\") &"\"&filename22

' 注销实例 
set jpeg = nothing 
end if
%>
