下面是在linux环境下
$exif = exif_read_data('test.jpg', "IFDO", false);
var_dump($exif);
读取的信息如下:
array(16) { ["FileName"]=> string(8) "test.jpg" ["FileDateTime"]=> int(1245132764) ["FileSize"]=> int(1136412) ["FileType"]=> int(2) ["MimeType"]=> string(10) "image/jpeg" ["SectionsFound"]=> string(26) "ANY_TAG, IFD0, EXIF, WINXP" ["COMPUTED"]=> array(5) { ["html"]=> string(26) "width="1680" height="1050"" ["Height"]=> int(1050) ["Width"]=> int(1680) ["IsColor"]=> int(1) ["ByteOrderMotorola"]=> int(0) } ["Software"]=> string(19) "Adobe Photoshop 7.0" ["DateTime"]=> string(19) "2006:05:10 11:30:17" ["Exif_IFD_Pointer"]=> int(268) ["Title"]=> string(1) "4" ["Comments"]=> string(1) "W" ["Author"]=> string(1) "M" ["ColorSpace"]=> int(65535) ["ExifImageWidth"]=> int(5061) ["ExifImageLength"]=> int(3481) }
["Title"]=> string(1) "4" ["Comments"]=> string(1) "W" ["Author"]=> string(1) "M" 图片中对应的内容分别是:
400232
MATTIAS KLUM
Water lily (Nymphaea sp.).Location: SWEDEN.同样的代码在winxp中是有用的
为何在linux中无效希望大家能帮我解决
$exif = exif_read_data('test.jpg', "IFDO", false);
var_dump($exif);
读取的信息如下:
array(16) { ["FileName"]=> string(8) "test.jpg" ["FileDateTime"]=> int(1245132764) ["FileSize"]=> int(1136412) ["FileType"]=> int(2) ["MimeType"]=> string(10) "image/jpeg" ["SectionsFound"]=> string(26) "ANY_TAG, IFD0, EXIF, WINXP" ["COMPUTED"]=> array(5) { ["html"]=> string(26) "width="1680" height="1050"" ["Height"]=> int(1050) ["Width"]=> int(1680) ["IsColor"]=> int(1) ["ByteOrderMotorola"]=> int(0) } ["Software"]=> string(19) "Adobe Photoshop 7.0" ["DateTime"]=> string(19) "2006:05:10 11:30:17" ["Exif_IFD_Pointer"]=> int(268) ["Title"]=> string(1) "4" ["Comments"]=> string(1) "W" ["Author"]=> string(1) "M" ["ColorSpace"]=> int(65535) ["ExifImageWidth"]=> int(5061) ["ExifImageLength"]=> int(3481) }
["Title"]=> string(1) "4" ["Comments"]=> string(1) "W" ["Author"]=> string(1) "M" 图片中对应的内容分别是:
400232
MATTIAS KLUM
Water lily (Nymphaea sp.).Location: SWEDEN.同样的代码在winxp中是有用的
为何在linux中无效希望大家能帮我解决
["Title"]=> string(1) "4" ["Comments"]=> string(1) "W" ["Author"]=> string(1) "M" 图片中对应的内容分别是:
400232
Water lily (Nymphaea sp.).Location: SWEDEN.
MATTIAS KLUM 每次读 出来的内容刚好是第一个字母 为何
$exif = @exif_read_data($file, O, true);
foreach ($exif as $key => $section){
if($key == 'IFD0'){
foreach ($section as $name => $val) {
if($name == 'DateTime' && $val != ''){
$this->DateTime = HtmlEncode(trim($val));
}
else if($name == 'Title' && $val != ''){
$this->Title = HtmlEncode(trim($val));
}
else if($name == 'Comments' && $val!= ''){
$this->Comments = HtmlEncode(trim($val));
}
else if($name == 'Author' && $val != ''){
$this->Author = HtmlEncode(trim($val));
}
}
}
}
function HtmlEncode($str){
$TempStr=trim($str);
$TempStr=htmlentities($TempStr,ENT_QUOTES);
return $TempStr;
}
可是将得到的数据插入到数据库当中的时候 然后再取数据的时候
就会出错 只能取到数据的第一个字符
不知道为何