Opened 14 years ago
Closed 10 years ago
#16251 closed enhancement (wontfix)
Change attachment image uploads to have post_date corresponding to EXIF created date
Reported by: | Otto42 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Media | Keywords: | dev-feedback |
Focuses: | Cc: |
Description
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.
add_filter('wp_update_attachment_metadata','attachment_redater',10,2); function attachment_redater($data, $id) { if (!empty($data['image_meta']['created_timestamp'])) { $post=get_post($id); $post->post_date = gmdate('Y-m-d H:i:s', $data['image_meta']['created_timestamp']); wp_update_post($post); } return $data; }
Change History (6)
#5
@
11 years ago
To sum up where this is:
- 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.
- exif data is captured (if it exists) into attachment metadata (under the key '_wp_attachment_metadata')
#6
@
10 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.
This is not so simple - post_date is implicitly assumed to be the date of upload:
IMO it may be better to leave post_date as the uploaded date, and read the creation date metadata manually as/when needed.