Sub ImagePersits
if IsObjInstalled("Persits.Jpeg") and SiteConfig("AttachmentsSaveOption")=1 and FileMIME="image/pjpeg" then
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath(""&SaveFile&"")
if UpClass="Face" then '上传头像自动缩放到后台设定的指定值
Jpeg.Width = Jpeg.OriginalWidth
Jpeg.Height = Jpeg.OriginalHeight
if Jpeg.OriginalWidth / Jpeg.OriginalHeight >= 1 then
if Jpeg.Width>SiteConfig("AvatarWidth") then
Jpeg.Width = SiteConfig("AvatarWidth")
Jpeg.Height = int((SiteConfig("AvatarWidth")/Jpeg.OriginalWidth)*Jpeg.OriginalHeight)
end if
elseif Jpeg.OriginalWidth / Jpeg.OriginalHeight < 1 then
if Jpeg.Height>SiteConfig("AvatarHeight") then
Jpeg.Height = SiteConfig("AvatarHeight")
Jpeg.Width= int(Jpeg.OriginalWidth*(SiteConfig("AvatarHeight")/Jpeg.OriginalHeight))
end if
end if
else '设置帖子附件图片水印效果
if SiteConfig("WatermarkOption")="Persits.Jpeg" then
JpegPersits
end if
end if
Jpeg.Save Server.MapPath(""&SaveFile&"")
Set Jpeg = nothing
end if
End Sub