Retrieving iPhone's Recents gallery media sorting (meta?)data

Started by krash002, March 23, 2025, 07:46:18 AM

Previous topic - Next topic

krash002

As far as I know, the Recents gallery on iPhone sorts media by some datetime they were added to the Photos gallery, but I'm not always able to tell which datetime it is for a particular photo as it doesn't always align with the datetime it shows above it.

For example, I have this sequence of logically-related photos (which I am 100% sure I added in one day), and here is how Recents sorts them and their displayed datetimes (YYYY:MM:DD HH:MM):

1. 2023:09:03 15:48
2. 2023:09:03 15:49
3. 2010:11:15 12:50 < ???
4. 2023:09:03 15:50
5. 2023:09:03 15:52

Even though some wrong (different) datetime is being displayed here for that third photo, the Recents gallery still does sort them properly in an intended way (by the in-gallery initial appearance order).

So my question is: where is that "gallery added datetime" located and whether it can be accessed somehow? Is there some internal inaccessible Photos app datetime accounting and photo association system that Recents make use of here to sort photos properly, or maybe it reads some metadata that is wired into that photo somewhere?

(As for the latter, I have tried transferring my photos to my Windows computer using USB, and using ExifTool software I managed to find DateTimeOriginal tag there that does correspond to that time being displayed in Recents, but it only works for photos that are Camera-taken and their edits, or screenshots and their edits, and for photos that aren't these (ones that were saved to the gallery, not originally created) there is first no such a tag at all, and second when I drag-and-drop photos from iPhone mounted to my PC, other (existing) datetime metadata fields are being rewritten immediately with something wrong - all of them get more recent values... But inspecting the photo directly from mounted device in Windows explorer without that drag-and-drop transferring while does not rewrite existing datetime fields, says nothing about the metadata I'm being interested in sadly (one that Recents apparently uses for its sorting).)

Thanks.

Phil Harvey

Run this command to see all times in a file and where they are located:

exiftool -time:all -a -s -G1 FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

krash002

I have tested a couple of photos this way, but I get inconsistent ranges of differences for each result.

(Example 1/2) For a photo whose displayed datetime in Recents is 2011:02:15 17:21, but the datetime I'm interested in must be something like 2023:09:03 15:55 (judging by two other logically-related photos on the sides), I get:
[System]        FileModifyDate                  : 2023:09:04 19:24:33+03:00 (closest: ~1 day difference)
[System]        FileAccessDate                  : 2025:03:23 13:55:25+02:00
[System]        FileCreateDate                  : 2025:03:21 15:40:02+02:00
[IFD0]          ModifyDate                      : 2011:02:15 17:21:42       (these (x) are what is being displayed in Recents to me, but I know it's "wrong")
[ExifIFD]       CreateDate                      : 2011:02:15 17:21:42       (x)
[XMP-xmp]       CreateDate                      : 2011:02:15 17:21:42+02:00 (x)
[XMP-xmp]       ModifyDate                      : 2011:02:15 17:21:42+02:00 (x)
[XMP-xmp]       MetadataDate                    : 2011:02:15 17:21:42+02:00 (x)
[ICC-header]    ProfileDateTime                 : 1998:02:09 06:49:00

(Example 2/2) For another photo whose display datetime in Recents is 2023:10:03 20:10 (here it displays "properly"), I get:
[System]        FileModifyDate                  : 2023:12:13 13:29:16+02:00 (closest: ~2 months difference)
[System]        FileAccessDate                  : 2025:03:23 14:03:43+02:00
[System]        FileCreateDate                  : 2025:03:21 15:40:03+02:00

As I mentioned in the post before, some metadata gets modified on iPhone-to-Windows USB transferring: apparently FileCreateDate tag shows datetime when I first copied it from there on my computer, and FileAccessDate tag just shows current datetime. Maybe if I could somehow prevent that behavior and then inspect files with the utility...

Phil Harvey

That example 2 is a problem because there seems to be no date/time metadata in the file.  Transferring from the phone to windows won't necessarily preserve the system dates.  I don't know if there is any more you can do by running ExifTool on Windows.  You may be able to learn more and possibly find a solution if there is an app that allows you to run ExifTool or some other metadata utility on your iPhone.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Images from social media, texts, and screenshots either strip away any embedded metadata or never had it to begin with.

I would suggest zipping the files before transferring them. When you zip a file, the file system time stamp is preserved (or it should be). Then when you extract the files, they should have the correct time stamp.

I found this page, though I can't verify how accurate it is since I don't using an iPhone.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

krash002

Thanks a lot, it solved it! Due to preliminary compression there is now proper values I was looking for in FileModifyDate tag instead of previously weird results I got (~1 day and ~2 months off for examples given):

(Example 1/2)
[System]        FileModifyDate                  : 2023:09:03 15:56:44+03:00 (corrected now! same date/time as it should be by previous approximation)
[System]        FileAccessDate                  : 2025:03:23 17:49:49+02:00
[System]        FileCreateDate                  : 2025:03:23 17:44:03+02:00
[IFD0]          ModifyDate                      : 2011:02:15 17:21:42
[ExifIFD]       CreateDate                      : 2011:02:15 17:21:42
[XMP-xmp]       CreateDate                      : 2011:02:15 17:21:42+02:00
[XMP-xmp]       ModifyDate                      : 2011:02:15 17:21:42+02:00
[XMP-xmp]       MetadataDate                    : 2011:02:15 17:21:42+02:00
[ICC-header]    ProfileDateTime                 : 1998:02:09 06:49:00

(Example 2/2)
[System]        FileModifyDate                  : 2023:10:03 20:10:50+03:00 (corrected as well; same as displayed in Recents)
[System]        FileAccessDate                  : 2025:03:23 17:51:22+02:00
[System]        FileCreateDate                  : 2025:03:23 17:51:12+02:00

I'm only a little bit concerned about the tag it put those values into since there is the "modify" word in there, so I'm not sure whether it will have "proper" values for all the media I have, or whether it may be rewritten for some and misalign with that initial appearance date/time in Recents I expect. I'll test it further and update if I'll encounter something weird, thanks!

StarGeek

The FileModifyDate is the last time the file was opened for editing. This tag is used by backup programs to tell if the file has been changed and need to be backed up.

The FileAccessDate is the last time the file was touched in any way, such as viewing. This tag should always be ignored, as the simple act of looking at the file changes it.

The FileCreateDate is when the file was created on that drive. This may or may not be stay the same when the file is copied. It depends upon what is doing the copying.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype