PHP获取图片的exif信息,PHP自带一个exif_read_data函数可以用来读取图片的exif信息,代码来自PHP手册
PHP;">
PHP
echo "test1.jpg:
\n"; $exif = exif_read_data('tests/test1.jpg','IFD0'); echo $exif===false ? "No header data found.
\n" : "Image contains headers
\n";
\n"; $exif = exif_read_data('tests/test1.jpg','IFD0'); echo $exif===false ? "No header data found.
\n" : "Image contains headers
\n";
$exif = exif_read_data('tests/test2.jpg',true);
echo "test2.jpg:
\n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val
\n";
}
}
?>
输出结果如下
以上所述就是本文的全部内容了,希望大家能够喜欢。