|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
由于ASP提供的是一对多的服务,所以用户的一些特殊需求很难得到满足。aspjpeg<%
ASPJPEG综合操纵CLASS
ClassAspJpeg
DimAspJpeg_Obj,obj
PrivateImg_MathPath_From,Img_MathPath_To,Img_Reduce_Size,CoverIf
PrivateImg_Frame_Size,Img_Frame_Color,Img_Frame_Solid,Img_Frame_Width,Img_Frame_Height
PrivateImg_Font_Content,Img_Font_Family,Img_Font_Color,Img_Font_Quality,Img_Font_Size,Img_Font_Bold,Img_Font_X,Img_Font_Y
PrivateImg_PicIn_Path,Img_PicIn_X,Img_PicIn_Y
--------------取原文件路径
PublicPropertyLetMathPathFrom(StrType)
Img_MathPath_From=StrType
EndProperty
--------------取文件保留路径
PublicPropertyLetMathPathTo(strType)
Img_MathPath_To=strType
EndProperty
--------------保留文件时是不是掩盖已有文件
PublicPropertyLetCovePro(LngSize)
IfLngSize=0orLngSize=1orLngSize=trueorLngSize=falsethen
CoverIf=LngSize
EndIf
EndProperty
---------------取缩略图/缩小图缩略值
PublicPropertyLetReduceSize(LngSize)
IfisNumeric(LngSize)then
Img_Reduce_Size=LngSize
EndIf
EndProperty
---------------取描边属性
边框粗细
PublicPropertyLetFrameSize(LngSize)
IfisNumeric(LngSize)then
Img_Frame_Size=Clng(LngSize)
EndIf
EndProperty
边框宽度
PublicPropertyLetFrameWidth(LngSize)
IfisNumeric(LngSize)then
Img_Frame_Width=Clng(LngSize)
EndIf
EndProperty
边框高度
PublicPropertyLetFrameHeight(LngSize)
IfisNumeric(LngSize)then
Img_Frame_Height=Clng(LngSize)
EndIf
EndProperty
边框色彩
PublicPropertyLetFrameColor(strType)
IfstrType""then
Img_Frame_Color=strType
EndIf
EndProperty
边框是不是加粗
PublicPropertyLetFrameSolid(LngSize)
IfLngSize=1orLngSize=0orLngSize=trueorLngSize=falsethen
Img_Frame_Solid=LngSize
EndIf
EndProperty
---------------取拔出笔墨属性
拔出的笔墨
PublicPropertyLetContent(strType)
IfstrType""then
Img_Font_Content=strType
EndIf
EndProperty
笔墨字体
PublicPropertyLetFontFamily(strType)
IfstrType""then
Img_Font_Family=strType
EndIf
EndProperty
笔墨色彩
PublicPropertyLetFontColor(strType)
IfstrType""then
Img_Font_Color=strType
EndIf
EndProperty
笔墨品德
PublicPropertyLetFontQuality(LngSize)
IfisNumeric(LngSize)then
Img_Font_Quality=Clng(LngSize)
EndIf
EndProperty
笔墨巨细
PublicPropertyLetFontSize(LngSize)
IfisNumeric(LngSize)then
Img_Font_Size=Clng(LngSize)
EndIf
EndProperty
笔墨是不是加粗
PublicPropertyLetFontBold(LngSize)
IfLngSize=1orLngSize=0orLngSize=trueorLngSize=falsethen
Img_Font_Bold=LngSize
EndIf
EndProperty
输出笔墨的X坐标
PublicPropertyLetFontX(LngSize)
IfisNumeric(LngSize)then
Img_Font_X=Clng(LngSize)
EndIf
EndProperty
输出笔墨的Y坐标
PublicPropertyLetFontY(LngSize)
IfisNumeric(LngSize)then
Img_Font_Y=Clng(LngSize)
EndIf
EndProperty
---------------取拔出图片属性
拔出图片的路径
PublicPropertyLetPicInPath(strType)
Img_PicIn_Path=strType
EndProperty
图片拔出的X坐标
PublicPropertyLetPicInX(LngSize)
IfisNumeric(LngSize)then
Img_PicIn_X=Clng(LngSize)
EndIf
EndProperty
图片拔出的Y坐标
PublicPropertyLetPicInY(LngSize)
IfisNumeric(LngSize)then
Img_PicIn_Y=Clng(LngSize)
EndIf
EndProperty
PrivateSubClass_Initialize()
SetAspJpeg_Obj=createObject("Persits.Jpeg")
Img_MathPath_From=""
Img_MathPath_To=""
Img_Reduce_Size=150
Img_Frame_Size=1
Img_Frame_Width=0
Img_Frame_Height=0
Img_Frame_Color="&H000000"
Img_Frame_Bold=false
Img_Font_Content="GoldenLeaf"
Img_Font_Family="Arial"
Img_Font_Color="&H000000"
Img_Font_Quality=3
Img_Font_Size=14
Img_Font_Bold=False
Img_Font_X=10
Img_Font_Y=5
Img_PicIn_X=0
Img_PicIn_Y=0
CoverIf=1
EndSub
PrivateSubClass_Terminate()
Err.Clear
SetAspJpeg_Obj=Nothing
EndSub
判别文件是不是存在
PrivateFunctionFileIs(path)
Setfsos=Server.createObject("Scripting.FileSystemObject")
FileIs=fsos.FileExists(path)
Setfsos=Nothing
EndFunction
判别目次是不是存在
PrivateFunctionFolderIs(path)
Setfsos=Server.createObject("Scripting.FileSystemObject")
FolderIs=fsos.FolderExists(path)
Setfsos=Nothing
EndFunction
*******************************************
函数感化:获得以后文件的上一级路径
*******************************************
PrivateFunctionUpDir(ByValD)
IfLen(D)=0then
UpDir=""
Else
UpDir=Left(D,InStrRev(D,"")-1)
EndIf
EndFunction
PrivateFunctionErrors(Errors_id)
selectCaseErrors_id
Case"0"
Errors="指定文件不存在"
Case1
Errors="指定目次不存在"
Case2
Errors="已存在不异称号文件"
Case3
Errors="参数溢出"
Endselect
EndFunction
取图片宽度
PublicFunctionImgInfo_Width(Img_MathPath)
IfNot(FileIs(Img_MathPath))then
ExitFunction
ImgInfo_Width=Errors(0)
Else
AspJpeg_Obj.OpenImg_MathPath
ImgInfo_Width=AspJpeg_Obj.width
EndIf
EndFunction
取图片高度
PublicFunctionImgInfo_Height(Img_MathPath)
IfNot(FileIs(Img_MathPath))then
ExitFunction
ImgInfo_Height=Errors(0)
Else
AspJpeg_Obj.OpenImg_MathPath
ImgInfo_Height=AspJpeg_Obj.height
EndIf
EndFunction
天生缩略图/缩小图
PublicFunctionImg_Reduce()
IfNot(FileIs(Img_MathPath_From))then
Img_Reduce=Errors(0)
ExitFunction
EndIf
IfNot(FolderIs(UpDir(Img_MathPath_To)))then
Img_Reduce=Errors(1)
ExitFunction
EndIf
IfCoverIf=0orCoverIf=Falsethen
IfFileIs(Img_MathPath_To)then
Img_Reduce=Errors(2)
ExitFunction
EndIf
EndIf
AspJpeg_Obj.OpenImg_MathPath_From
AspJpeg_Obj.PreserveAspectRatio=True
IfAspJpeg_Obj.OriginalWidth>AspJpeg_Obj.OriginalHeightThen
AspJpeg_Obj.Width=Img_Reduce_Size
Else
AspJpeg_Obj.Height=Img_Reduce_Size
EndIf
IfAspJpeg_Obj.OriginalWidth>Img_Reduce_SizeorAspJpeg_Obj.OriginalHeight>Img_Reduce_SizeThen
IfAspJpeg_Obj.Width<Img_Reduce_SizeorAspJpeg_Obj.Height<Img_Reduce_Sizethen
SetAspJpeg_Obj_New=createObject("Persits.Jpeg")
AspJpeg_Obj_New.newImg_Reduce_Size,Img_Reduce_Size,&HFFFFFF
AspJpeg_Obj_New.DrawImage(150-AspJpeg_Obj.width)/2,(150-AspJpeg_Obj.height)/2,AspJpeg_Obj
IfImg_Frame_Size>0then
CallImg_Pen(AspJpeg_Obj_New)
EndIf
IfImg_Font_Content""then
Img_Font_X=AspJpeg_Obj_New.Width/2
Img_Font_Y=AspJpeg_Obj_New.Height-15
CallImg_Font(AspJpeg_Obj_New)
EndIf
AspJpeg_Obj_New.Sharpen1,130
AspJpeg_Obj_New.SaveImg_MathPath_To
SetAspJpeg_Obj_New=Nothing
Else
IfImg_Frame_Size>0then
CallImg_Pen(AspJpeg_Obj)
EndIf
IfImg_Font_Content""then
Img_Font_X=AspJpeg_Obj.Width/2
Img_Font_Y=AspJpeg_Obj.Height-15
CallImg_Font(AspJpeg_Obj)
EndIf
AspJpeg_Obj.Sharpen1,130
AspJpeg_Obj.SaveImg_MathPath_To
EndIf
Else
IfImg_Frame_Size>0then
CallImg_Pen(AspJpeg_Obj)
EndIf
IfImg_Font_Content""then
Img_Font_X=AspJpeg_Obj.Width/2
Img_Font_Y=AspJpeg_Obj.Height-15
CallImg_Font(AspJpeg_Obj)
EndIf
AspJpeg_Obj.Sharpen1,130
AspJpeg_Obj.SaveImg_MathPath_To
EndIf
EndFunction
天生水印
PublicFunctionImg_WaterMark()
IfNot(FileIs(Img_MathPath_From))then
Img_WaterMark=Errors(0)
ExitFunction
EndIf
IfImg_MathPath_To=""then
Img_MathPath_To=Img_MathPath_From
ElseIfNot(FolderIs(UpDir(Img_MathPath_To)))then
Img_WaterMark=Errors(1)
ExitFunction
EndIf
IfCoverIf=0orCoverIf=falsethen
IfImg_MathPath_ToImg_MathPath_FromandFileIs(Img_MathPath_To)then
Img_WaterMark=Errors(2)
ExitFunction
EndIf
EndIf
AspJpeg_Obj.OpenImg_MathPath_From
IfImg_PicIn_Path""then
IfNot(FileIs(Img_PicIn_Path))then
Img_WaterMark=Errors(0)
ExitFunction
EndIf
SetAspJpeg_Obj_New=createObject("Persits.Jpeg")
AspJpeg_Obj_New.OpenImg_PicIn_Path
AspJpeg_Obj.PreserveAspectRatio=True
AspJpeg_Obj_New.PreserveAspectRatio=True
IfAspJpeg_Obj.OriginalWidth<Img_Reduce_SizeorAspJpeg_Obj.OriginalHeight<Img_Reduce_Sizethen
Img_WaterMark=Errors(3)
ExitFunction
EndIf
IfAspJpeg_Obj_New.OriginalWidth>AspJpeg_Obj_New.OriginalHeightThen
AspJpeg_Obj_New.Width=Img_Reduce_Size
Else
AspJpeg_Obj_New.Height=Img_Reduce_Size
EndIf
IfImg_PicIn_X=""thenImg_PicIn_X=AspJpeg_Obj.Width-AspJpeg_Obj_New.Width
IfImg_PicIn_Y=""thenImg_PicIn_Y=AspJpeg_Obj.Height-AspJpeg_Obj_New.Height
AspJpeg_Obj.DrawImageImg_PicIn_X,Img_PicIn_Y,AspJpeg_Obj_New
SetAspJpeg_Obj_New=Nothing
EndIf
IfImg_Frame_Size>0then
CallImg_Pen(AspJpeg_Obj)
EndIf
IfImg_Font_Content""then
CallImg_Font(AspJpeg_Obj)
EndIf
AspJpeg_Obj.Sharpen1,130
AspJpeg_Obj.SaveImg_MathPath_To
EndFunction
天生框架
PrivateFunctionImg_Pen(Obj)
IfImg_Frame_Width=0thenImg_Frame_Width=Obj.Width
IfImg_Frame_Height=0thenImg_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.Bar1,1,Img_Frame_Width,Img_Frame_Height
EndFunction
天生水印字
PrivateFunctionImg_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.PrintImg_Font_X,Img_Font_Y,Img_Font_Content
EndFunction
EndClass
%>
这个类能够公然挪用
1.ImgInfo_Height取图片高度
2.ImgInfo_Width取图片宽度
挪用办法:
程序代码
DimNewObj,Pic_h,Pic_w
SetNewObj=NewAspJpeg
Pic_h=NewObj.ImgInfo_Height("f:/test.jpg")
Pic_w=NewObj.ImgInfo_Width("f:/test.jpg")
SetNewObj=Nothing
Response.Write"ThisPicturesHeightis"&Pic_h
Response.Write"ThisPicturesWidthis"&Pic_w
Response.End
3.Img_Reduce对指定图片减少或缩小并保留(可选择是不是加水印,是不是加框架)
必需界说声明MathPathFrom,MathPathTo
默许为缩放至150X150图案如按比例缩放后图案小于该尺寸,则增补空缺图片
默许文件主动掩盖
实例:
程序代码
DimNewObj,NewCommand
SetNewObj=NewAspJpeg
NewObj.MathPathFrom="f:/test.jpg"
NewObj.MathPathTo="f:/reduce.jpg"
NewCommand=NewObj.Img_Reduce
SetNewObj=Nothing
IfNewCommand""then
Response.Write"Success"
Else
图片操纵过程当中呈现毛病
Response.Write"Failed"
EndIf
4.Img_WaterMark给指定图片增加水印
水印能够为图片笔墨或2者分离当然了,现在国内CRM厂商的产品与其说是CRM,但从至少从我的角度分析上来看,充其量只是一个大型的进销存而已了,了解尚浅,不够胆详评,这里只提技术问题 |
|