Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fetching the precise date time including milliseconds the time photo is taken from image file in php

Tags:

php

exif

I am developing a Web Application using PHP Laravel that involves some processing as well. What I am doing now is I am trying to extract the time taken from the image file when user uploads the file. I can extract the data using exif_read_data function like this.

$exif_data = exif_read_data($file);
echo $exif_data['DateTimeOriginal'];

When I retrieve, the format is YYYY:MM:DD H:m:s. But I also need to know the milli/nano seconds as well after seconds. So, is there a way to retrieve more precise time the photo is taken from the image file and how can I do it?

like image 551
Wai Yan Hein Avatar asked Mar 07 '23 09:03

Wai Yan Hein


1 Answers

you should be able to get the millisecond/nanosecond resolution from the sub-second tags: SubsecTime, SubsecTimeOriginal or SubsecTimeDigitized, which are the array keys of the EXIF information.

like image 197
michasaurus Avatar answered Mar 08 '23 23:03

michasaurus