我正在使用exif_read_data PHP函数从照片中检索创建日期(请参见下面的代码。)从未经修改的照片中检索的日期将返回“拍摄日期”。那些已被修改的-“日期已修改”。有没有办法忽略“修改日期”字段来获取照片的拍摄日期?
$exif_data = exif_read_data ($filename);
if (!empty($exif_data['DateTime'])) {
$exif_date = $exif_data['DateTime'];
}
谢谢你。
编辑:我认为$ exif_data ['DateTime']使用第一个可用的日期字段。由于未修改的图像的“修改日期”和“拍摄日期”具有相同的值,因此在我的情况下,总是检索“修改日期”。
最佳答案
好的,我知道这是一年前发布的问题,但是有点晚了,但是我发布这个答案是因为我有同样的问题,我的丈夫给了我一两个关于如何获得答案的技巧,所以我分享了它。
编写一个php脚本以打印出exif_read_data数组,您会发现各种有趣的信息。此(下)使用print_r()在命令行上打印到标准输出。如果向下滚动,您将看到两个非常有趣的键:
[DateTime] => 2011:06:21 17:50:57和[DateTimeOriginal] => 2011:06:04 08:56:22
希望这些可以帮助您获得所需的东西。
大批
(
[FileName] => Pirate(F).JPG
[FileDateTime] => 1405733742
[FileSize] => 4017033
[FileType] => 2
[MimeType] =>图片/jpeg
[SectionsFound] => ANY_TAG,IFD0,THUMBNAIL,COMMENT,EXIF
[COMPUTED] =>数组
(
[html] => width =“2592” height =“3888”
[高度] => 3888
[宽度] => 2592
[IsColor] => 1
[ByteOrderMotorola] => 1
[ApertureFNumber] => f/16.0
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] =>图片/jpeg
)
[制造] =>佳能
[型号] =>佳能EOS DIGITAL REBEL XS
[方向] => 1
[XResolution] => 4718592/65536
[YResolution] => 4718592/65536
[ResolutionUnit] => 2
[软件] => QuickTime 7.6.9
[DateTime] => 2011:06:21 17:50:57
[HostComputer] => Mac OS X 10.5.8
[YCbCrPositioning] => 1
[Exif_IFD_Pointer] => 260
[THUMBNAIL] =>数组
(
[压缩] => 6
[XResolution] => 4718592/65536
[YResolution] => 4718592/65536
[ResolutionUnit] => 2
[JPEGInterchangeFormat] => 628
[JPEGInterchangeFormatLength] => 4867
[YCbCrPositioning] => 1
)
[COMMENT] =>数组
(
[0] => AppleMark
)
[ExposureTime] => 1/200
[FNumber] => 16/1
[ExposureProgram] => 2
[ISOSpeedRatings] => 400
[ExifVersion] => 0220
[DateTimeOriginal] => 2011:06:04 08:56:22
[DateTimeDigitized] => 2011:06:04 08:56:22
[ShutterSpeedValue] => 499712/65536
[ApertureValue] => 524288/65536
[ExposureBiasValue] => 0/1
[MeteringMode] => 5
[Flash] => 9
[FocalLength] => 18/1
[ColorSpace] => 1
)