显示数码图片的EXIF信息 Discuz插件ForDiscuz5.0
来源:www.phpres.com 作者:Angelover 出处:www.phpres.com 2008-5-8 20:45:47 进入讨论组
这个插件最早是由JackMing发布在freediscuz上的for discuz 2.0版本,后来我将他更新至2.5 sp1版本,现移植至for D4.x和D5版,其实移植过程无需太多修改,为了方便需要的朋友,我重新整理下,如有错误希望原作者和使用过的朋友指正。
9月14号
现发现有未解决的问题:
1,开了水印功能便无法显示EXIF信息,有网友好像有了解决方案,本人最近比较忙,望能补充完善他。
2,下载附件来路检查功能开启有时会失效
3,无法在UTF8版本中使用,会乱码
4,有可能不支持php5,此条暂时有待证实
+++++++++++++++++++++++++
PHP开发资源网[http://php.phpres.com]
HACK名稱: 显示数码图片的EXIF信息
適用版本: discuz!5
原作者: JackMing (老么 修改移植至 for D5版本)
修改文件: viewthread.php
修改模板: viewthread.htm
+++++++++++++++++++++++++
安装步骤
1、修改文件viewthread.php
查找:$postlist[$attach['pid']]['attachments'][$attach['aid']]
在前面填入:
/*--------------------------------
显示jpeg和tiff图片的EXIF信息*/
if (($extension == 'jpg' || $extension == 'jpeg') && function_exists
('read_exif_data')){
$exif = @read_exif_data($discuz_root."./attachments/".$attach
[attachment],0,true);
if ($exif['EXIF']['ExifVersion']){
$attach['exif']="EXIF版本:".$exif['EXIF']['ExifVersion'].
" 相机品牌:".$exif['IFD0']['Make'].
" 相机型号:".$exif['IFD0']['Model'].
" 光圈:".$exif['COMPUTED']['ApertureFNumber'].
" 快门:".$exif['EXIF']['ExposureTime'].
" 感光度ISO:".$exif['EXIF']
[ISOSpeedRatings];
}
}
/*-------------------------------*/
PHP开发资源网[http://php.phpres.com] = 全球最大的PHP中文社群 = PHPer的网上家园
2、修改模版viewthread.htm
FOR D4.x
查找:
<img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);">
后面填入:<br>$attach['exif']
注意:
本hack主要利用了read_exif_data函数,该函数是不用gd库的,但是在默认情况下这个函数是无法使用的,打开该函数的方法如下:
UNIX/LINUX:编译PHP的时候,应该加上 --enable-exif选项,
Windows:
1、在PHP.ini里面,找到 ;extension=php_exif.dll 去掉分号。
2、找到[exif]段,把下面语句的分号去掉。
;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel = JIS
对于大部分jpg图片都是没有可用的EXIF信息的,除非是最近的数码作品。
最后提供点参数给有特殊需求的专业人士:(以下加入的格式可参照修改viewthread.php中的基本格式)
"文件名" => $exif[FILE][FileName],
"文件类型" => $imgtype[$exif[FILE][FileType]],
文件格式" => $exif[FILE][MimeType],
"文件大小" => $exif[FILE][FileSize],
"时间戳" => date("Y-m-d H:i:s",$exif[FILE][FileDateTime]),
"图片说明" => $exif[IFD0][ImageDescription],
"制造商" => $exif[IFD0][Make],
"型号" => $exif[IFD0][Model],
"方向" => $Orientation[$exif[IFD0][Orientation]],
"水平分辨率" => $exif[IFD0][XResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]],
"垂直分辨率" => $exif[IFD0][YResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]],
"创建软件" => $exif[IFD0][Software],
"修改时间" => $exif[IFD0][DateTime],
"作者" => $exif[IFD0][Artist],
"YCbCr位置控制" => $YCbCrPositioning[$exif[IFD0][YCbCrPositioning]],
"版权" => $exif[IFD0][Copyright],
"摄影版权" => $exif[COMPUTED][Copyright.Photographer],
"编辑版权" => $exif[COMPUTED][Copyright.Editor],
"Exif版本" => $exif[EXIF][ExifVersion],
"FlashPix版本" => "Ver. ".number_format($exif[EXIF][FlashPixVersion]/100,2),
"拍摄时间" => $exif[EXIF][DateTimeOriginal],
"数字化时间" => $exif[EXIF][DateTimeDigitized],
"拍摄分辨率高" => $exif[COMPUTED][Height],
"拍摄分辨率宽" => $exif[COMPUTED][Width],
"光圈" => $exif[EXIF][ApertureValue],
"快门速度" => $exif[EXIF][ShutterSpeedValue],
"快门光圈" => $exif[COMPUTED][ApertureFNumber],
"最大光圈值" => "F".$exif[EXIF][MaxApertureValue],
"曝光时间" => $exif[EXIF][ExposureTime],
"F-Number" => $exif[EXIF][FNumber],
"测光模式" => GetImageInfoVal($exif[EXIF][MeteringMode],$MeteringMode_arr),
"光源" => GetImageInfoVal($exif[EXIF][LightSource], $Lightsource_arr),
"闪光灯" => GetImageInfoVal($exif[EXIF][Flash], $Flash_arr),
"曝光模式" => ($exif[EXIF][ExposureMode]==1?"手动":"自动"),
"白平衡" => ($exif[EXIF][WhiteBalance]==1?"手动":"自动"),
"曝光程序" => $ExposureProgram[$exif[EXIF][ExposureProgram]],
"曝光补偿" => $exif[EXIF][ExposureBiasValue]."EV",
"ISO感光度" => $exif[EXIF][ISOSpeedRatings],
"分量配置" => (bin2hex($exif[EXIF][ComponentsConfiguration])=="01020300"?"YCbCr":"RGB"),//'0x04,0x05,0x06,0x00'="RGB" '0x01,0x02,0x03,0x00'="YCbCr"
"图像压缩率" => $exif[EXIF][CompressedBitsPerPixel]."Bits/Pixel",
"对焦距离" => $exif[COMPUTED][FocusDistance]."m",
"焦距" => $exif[EXIF][FocalLength]."mm",
"等价35mm焦距" => $exif[EXIF][FocalLengthIn35mmFilm]."mm",
·在PHP中cookie和session的使用总结
·哪个CMS比较好用-Mambo出鞘,谁与争锋?
·在PHP中使用Header()函数介绍
·用PHP实现JS的escape和unescape函数功能
·Cute Editor for PHP 6.0─ 一個所見即所得
·每一個 PHP 開發者都應該認識的十個開發項
·整理的Discuz程序文件目录含义表
·使用PHP伪造sessionid做防刷新功能
·介绍一种PHP权限控制系统-PHPGACL
·在PHP中cookie和session的使用总结
·哪个CMS比较好用-Mambo出鞘,谁与争锋?
·在PHP中使用Header()函数介绍
·用PHP实现JS的escape和unescape函数功能
·Cute Editor for PHP 6.0─ 一個所見即所得
·每一個 PHP 開發者都應該認識的十個開發項
·整理的Discuz程序文件目录含义表
·使用PHP伪造sessionid做防刷新功能
·介绍一种PHP权限控制系统-PHPGACL
- > 3分钟快速了解 Delphi for PHP 特色 (中文), PDF档
- > 购买Delphi for PHP的五大理由, PDF档
- > Delphi for PHP 使用规格介绍, PDF档
- > Delphi for PHP 問答集 (From CodeGear)
- > Delphi for PHP 产品价格表



