?? jpeg.asp
字號:
<%
'參數說明
'path1源圖片路徑包括圖片的名稱
'path2縮略圖的路徑包括圖片的名稱
'tp_width要生成縮略圖的最大寬度
'tp_height要生成縮略圖的最大高度
'調用aspjpeg path1,path2,tp_width,tp_height
function aspjpeg(path1,path2,tp_width,tp_height)
'------------生成縮略圖
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Path = Server.MapPath(trim(path1))
set fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(Path)=true then
Jpeg.Open Path
Jpeg.Width =Jpeg.OriginalWidth
Jpeg.Height =Jpeg.OriginalHeight
max_width=tp_width
max_height=tp_height
if Jpeg.OriginalWidth>max_width then
Jpeg.Width =max_width
Jpeg.Height =Jpeg.OriginalHeight * (Jpeg.Width / Jpeg.OriginalWidth)
if Jpeg.Height>max_height then
Jpeg.Height=max_height
Jpeg.Width =Jpeg.OriginalWidth * (Jpeg.Height / Jpeg.OriginalHeight)
end if
else
if Jpeg.OriginalHeight>max_height then
Jpeg.Height=max_height
Jpeg.Width =Jpeg.OriginalWidth * (Jpeg.Height / Jpeg.OriginalHeight)
end if
end if
Jpeg.Canvas.Font.Color = &H666666 ' 白色
Jpeg.Canvas.Font.Family = "Arial, Helvetica, sans-serif"
if Jpeg.Width<=80 then
Jpeg.Canvas.Font.size = 12 '文字大小
else
Jpeg.Canvas.Font.size = 14 '文字大小
end if
Jpeg.Canvas.Font.Bold = true '是否加粗
'Jpeg.Canvas.Font.BkMode = "Opaque"'文字背景(Opaque不透明,transparence透明)
Jpeg.Canvas.Font.Quality = 2'//水印文字的清晰度,從0~4,變換不是很大,建議用2或3。
Jpeg.Canvas.Font.ShadowColor = &Hffffff '//水印文字的陰影色彩。
Jpeg.Canvas.Font.ShadowXoffset = 1 '//水印文字陰影向右偏移的像素值,輸入負值則向左偏移。
Jpeg.Canvas.Font.ShadowYoffset = 1 '//水印文字陰影向下偏移的像素值,輸入負值則向右偏移。
this_x=1
if Jpeg.Width>80 then this_x=(Jpeg.Width-80)/2
if this_x<0 then this_x=1
this_y=Jpeg.Height*6/8
Jpeg.Canvas.Print this_x,this_y, "通用圖片投票系統"'x,y坐標與水印文字
if fso.fileexists(Server.MapPath(trim(path2)))=false then
Jpeg.Save Server.MapPath(trim(path2))'生成縮略圖并加水印
Set Jpeg = Nothing
'aspjpeg_shuiyin path1
end if
end if
end function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -