Make WordPress Core

Opened 13 years ago

Closed 9 years ago

#16251 closed enhancement (wontfix)

Change attachment image uploads to have post_date corresponding to EXIF created date

Reported by: otto42's profile Otto42 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords: dev-feedback
Focuses: Cc:


General idea is that if an image has EXIF data about its creation time, we should use that as the post_date in the attachment post, since the attachment post is the representation in WordPress of the attachment file.

Advantages: The posts will show their proper dates of creation by simply using the_date and similar functions.

This code will do it as a plugin. A patch would be much simpler and more generally beneficial.

function attachment_redater($data, $id) {
	if (!empty($data['image_meta']['created_timestamp'])) {
		$post->post_date = gmdate('Y-m-d H:i:s', $data['image_meta']['created_timestamp']);
	return $data;

Change History (6)

#1 @Otto42
13 years ago

  • Type changed from defect (bug) to enhancement

#2 @nacin
13 years ago

  • Milestone changed from Awaiting Review to Future Release

#3 @solarissmoke
13 years ago

  • Keywords dev-feedback added

This is not so simple - post_date is implicitly assumed to be the date of upload:

  • Currently the Media Editor shows you the "Upload Date" of the image. The plugin code you posted above changes that to the creation date, which is obviously wrong. Same thing when you view the attachment - it says "Published on [post_date]".
  • WP defaults to storing media in yyyy/mm based folders - based on upload date. Again potential for confusion if you change post_date.

IMO it may be better to leave post_date as the uploaded date, and read the creation date metadata manually as/when needed.

#4 @SergeyBiryukov
13 years ago

#17485 has more discussion on this.

#5 @ericlewis
10 years ago

To sum up where this is:

  1. on #17485 some folks thought EXIF creation time should dictate post date (westi), some didn't (azaozz, jane, scribu), but most thought filtering/ordering by this data in some regard would be useful.
  2. exif data is captured (if it exists) into attachment metadata (under the key '_wp_attachment_metadata')

#6 @helen
9 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I would like to be able to filter by this, but uploaded date is typically more useful - you generally want to insert things you uploaded recently. I also think this would be a difficult change to make now.

Note: See TracTickets for help on using tickets.