php获取图片的exif信息,php自带一个exif_read_data函数可以用来读取图片的exif信息,代码来自php手册
<?php
echo "test1.jpg:<br />n";
$exif = exif_read_data('tests/test1.jpg', 'ifd0');
echo $exif===false ? "no header data found.<br />n" : "image contains headers<br />n";
$exif = exif_read_data('tests/test2.jpg', 0, true);
echo "test2.jpg:<br />n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />n";
}
}
?>
输出结果如下
test1.jpg: no header data found. test2.jpg: file.filename: test2.jpg file.filedatetime: 1017666176 file.filesize: 1240 file.filetype: 2 file.sectionsfound: any_tag, ifd0, thumbnail, comment computed.html: width="1" height="1" computed.height: 1 computed.width: 1 computed.iscolor: 1 computed.byteordermotorola: 1 computed.usercomment: exif test image. computed.usercommentencoding: ascii computed.copyright: photo (c) m.boerger, edited by m.boerger. computed.copyright.photographer: photo (c) m.boerger computed.copyright.editor: edited by m.boerger. ifd0.copyright: photo (c) m.boerger ifd0.usercomment: ascii thumbnail.jpeginterchangeformat: 134 thumbnail.jpeginterchangeformatlength: 523 comment.0: comment #1. comment.1: comment #2. comment.2: comment #3end thumbnail.jpeginterchangeformat: 134 thumbnail.thumbnail.height: 1 thumbnail.thumbnail.height: 1
以上所述就是本文的全部内容了,希望大家能够喜欢。
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!