If AspJpeg_Obj_New.OriginalWidth>AspJpeg_Obj_New.OriginalHeight Then
AspJpeg_Obj_New.Width=Img_Reduce_Size
Else
AspJpeg_Obj_New.Height=Img_Reduce_Size
End If
If Img_PicIn_X="" then Img_PicIn_X=AspJpeg_Obj.Width-AspJpeg_Obj_New.Width
If Img_PicIn_Y="" then Img_PicIn_Y=AspJpeg_Obj.Height-AspJpeg_Obj_New.Height
AspJpeg_Obj.DrawImage Img_PicIn_X,Img_PicIn_Y,AspJpeg_Obj_New
Set AspJpeg_Obj_New=Nothing
End If
If Img_Frame_Size>0 then
Call Img_Pen(AspJpeg_Obj)
End If
If Img_Font_Content<>"" then
Call Img_Font(AspJpeg_Obj)
End If
'AspJpeg_Obj.Sharpen 1, 130
AspJpeg_Obj.Save Img_MathPath_To
End Function
'生成框架
Private Function Img_Pen(Obj)
If Img_Frame_Width=0 then Img_Frame_Width=Obj.Width
If Img_Frame_Height=0 then Img_Frame_Height=Obj.Height
Obj.Canvas.Pen.Color = Img_Frame_Color
Obj.Canvas.Pen.Width = Img_Frame_Size
Obj.Canvas.Brush.Solid = Img_Frame_Solid
Obj.Canvas.Bar 1,1,Img_Frame_Width,Img_Frame_Height
End Function
'生成水印字
Private Function Img_Font(Obj)
Obj.Canvas.Font.Color = Img_Font_Color
Obj.Canvas.Font.Family = Img_Font_Family
Obj.Canvas.Font.Quality=Img_Font_Quality
Obj.Canvas.Font.Size=Img_Font_Size
Obj.Canvas.Font.Bold = Img_Font_Bold
Obj.Canvas.Print Img_Font_X,Img_Font_Y,Img_Font_Content
End Function
End Class
%>
这个类可以公开调用
1. ImgInfo_Height 取图片高度
2. ImgInfo_Width 取图片宽度
调用方法:
复制代码 代码如下:
Dim NewObj,Pic_h,Pic_w
Set NewObj=New AspJpeg
Pic_h=NewObj.ImgInfo_Height("f:/test.jpg")
Pic_w=NewObj.ImgInfo_Width("f:/test.jpg")
Set NewObj=Nothing
Response.Write "This Picture's Height is "&Pic_h
Response.Write "This Picture's Width is "&Pic_w
Response.End
3. Img_Reduce 对指定图片缩小或放大并保存(可选择是否加水印,是否加框架)
必须定义声明 MathPathFrom,MathPathTo
默认为缩放至150X150 图案 如按比例缩放后图案小于该尺寸,则补充空白图片
默认文件自动覆盖
实例:
复制代码
内容版权声明:除非注明,否则皆为本站原创文章。