注册
找回密码
账号 记住
2422
2
118
0
653
10
17
给你代码 自己小改下 做个公用函数 然后GetImageExifInfo(PicURL)调用就可以了
复制代码 <%'********************************************************************************'函数名:GetImageExifInfo'功 能:获取基本的Exif信息'参 数:PicURL 文件路径,相对路径'返 回:用|分隔的字符串'********************************************************************************Function GetImageExifInfo(PicURL) Dim TempStr, TempSplit Dim ExifInfo set ExifInfo =new Cls_Exif OnErrorResumeNext ExifInfo.ImageFile = Server.MapPath(PicURL) If Err<>0Then Err.Clear OnErrorGoto0 Set ExifInfo =Nothing GetImageExifInfo ="" ExitFunction Else OnErrorGoto0 Endif if ExifInfo.hasExifInfo() and ExifInfo.GetExifByName("Camera Make")<>""then TempStr = ExifInfo.GetExifByName("Camera Make") GetImageExifInfo = ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Camera Model") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Date Time Original") IfLeft(TempStr, 4) ="0000"Then TempStr = ExifInfo.GetExifByName("Date Time Digitized") EndIf IfLeft(TempStr, 4) ="0000"Then TempStr = ExifInfo.GetExifByName("Date Time") EndIf IfLeft(TempStr, 4) ="0000"Then TempStr ="" EndIf GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Exif Image Width") TempSplit = ExifInfo.GetExifByName("Exif Image Height") if TempStr <>""and TempSplit<>""then TempStr = TempStr &" * "& TempSplit else TempStr ="" endif GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Software") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("ISO Speed Ratings") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("FStop") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Exposure Time") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Flash") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Exposure Bias Value") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Focal Length") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Metering Mode") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) else GetImageExifInfo ="" endif Set ExifInfo =NothingEnd FunctionFunction GetAllExifInfo(PicURL) set ExifInfo =new Cls_Exif OnErrorResumeNext ExifInfo.ImageFile = Server.MapPath(PicURL) GetAllExifInfo=ExifInfo.ExifAllInfo() Set ExifInfo =NothingEnd FunctionFunction GetHexInfo(PicURL) set ExifInfo =new Cls_Exif OnErrorResumeNext ExifInfo.ImageFile = Server.MapPath(picURL) GetHexInfo=ExifInfo.ExifAllInfo2() Set ExifInfo =NothingEnd FunctionFunction ExifItem(ItemValue) if ItemValue <>""then ExifItem = ExifItem & Server.HtmlEnCode(ItemValue) else ExifItem = ExifItem &"未知" endifEnd Function%>
<%'********************************************************************************'函数名:GetImageExifInfo'功 能:获取基本的Exif信息'参 数:PicURL 文件路径,相对路径'返 回:用|分隔的字符串'********************************************************************************Function GetImageExifInfo(PicURL) Dim TempStr, TempSplit Dim ExifInfo set ExifInfo =new Cls_Exif OnErrorResumeNext ExifInfo.ImageFile = Server.MapPath(PicURL) If Err<>0Then Err.Clear OnErrorGoto0 Set ExifInfo =Nothing GetImageExifInfo ="" ExitFunction Else OnErrorGoto0 Endif if ExifInfo.hasExifInfo() and ExifInfo.GetExifByName("Camera Make")<>""then TempStr = ExifInfo.GetExifByName("Camera Make") GetImageExifInfo = ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Camera Model") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Date Time Original") IfLeft(TempStr, 4) ="0000"Then TempStr = ExifInfo.GetExifByName("Date Time Digitized") EndIf IfLeft(TempStr, 4) ="0000"Then TempStr = ExifInfo.GetExifByName("Date Time") EndIf IfLeft(TempStr, 4) ="0000"Then TempStr ="" EndIf GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Exif Image Width") TempSplit = ExifInfo.GetExifByName("Exif Image Height") if TempStr <>""and TempSplit<>""then TempStr = TempStr &" * "& TempSplit else TempStr ="" endif GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Software") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("ISO Speed Ratings") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("FStop") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Exposure Time") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Flash") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Exposure Bias Value") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Focal Length") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) TempStr = ExifInfo.GetExifByName("Metering Mode") GetImageExifInfo = GetImageExifInfo &"|"& ExifItem(TempStr) else GetImageExifInfo ="" endif Set ExifInfo =NothingEnd FunctionFunction GetAllExifInfo(PicURL) set ExifInfo =new Cls_Exif OnErrorResumeNext ExifInfo.ImageFile = Server.MapPath(PicURL) GetAllExifInfo=ExifInfo.ExifAllInfo() Set ExifInfo =NothingEnd FunctionFunction GetHexInfo(PicURL) set ExifInfo =new Cls_Exif OnErrorResumeNext ExifInfo.ImageFile = Server.MapPath(picURL) GetHexInfo=ExifInfo.ExifAllInfo2() Set ExifInfo =NothingEnd FunctionFunction ExifItem(ItemValue) if ItemValue <>""then ExifItem = ExifItem & Server.HtmlEnCode(ItemValue) else ExifItem = ExifItem &"未知" endifEnd Function%>
科讯cms[/backcolor][/color][/url]web前端技术[/url] www.webx32.com[/url] [/color] 科讯有问必答QQ群 17478244(VIP高级群)[/color][/size][/align]