#532 closed enhancement (fixed)
Show creation date (extract from EXIF)
Reported by: | tryggvib | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 0.4.0 |
Component: | programming | Keywords: | exif, DateTimeOriginal, review |
Cc: | Elrond | Parent Tickets: |
Description
Short description
Add an option to make the creation date (as defined in the EXIF information) of a media object visible, e.g. to show when a photo was taken, not when it was added to the mediagoblin instance.
This should be optional since not everyone might want this information to be visible.
User stories
Sysadmin makes creation date visible for media objects
Shaquannah the sysadmin updates the configuration file for her mediagoblin instance and sets original_date_visible to true to show when pictures (or other media objects with the corresponding EXIF information) were taken/created.
Visitor sees the creation date for a given media object
Spencer the guest browses to a media object's page and sees the date for when a picture (or other media object given EXIF information) was taken/created. Spencer sees this information in the sidebar, below the date indicating when the media object was added to the mediagoblin instance he's visiting.
Change History (12)
comment:2 by , 12 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:3 by , 12 years ago
Sorry for slow reply. Holidaze, and all that.
So thoughts: first of all, great idea!
There's one problem with splitting and re-joining the string this way in the template... it isn't localized. We could try to solve this via:
- Putting the datetime object in the template context (that might be context creep, not sure).
- Alternately we can pull the date out of the EXIF field and put it into a real, queryable SQL field in the ImageData table. The other advantage is that we could construct SQL queries on it if we for some reason wanted to. However, it would also require a migration, and I'm not 100% sure if it's worth it or not.
- Another option which doesn't require adding such a field at all! Make a .created_date() method on the ImageData that does the same thing that's happening here in the template, but actually in the model. This doesn't require passing anything weird at all into the template, and thusly may be my preferred method!
I'd love to hear Elrond or etc's thoughts, but at the moment I think the last option may be the best?
Happy to walk you through this on IRC if you're willing to make that change! And thanks for taking the initiative on this!
comment:4 by , 12 years ago
Cc: | added |
---|
comment:5 by , 12 years ago
Owner: | changed from | to
---|
comment:6 by , 12 years ago
Owner: | changed from | to
---|
Went with the third method. For me it makes sense to move it from the view to the controller/model (I added a method called get_original_date() to the ImageDate model class.
The template now only checks if original_date_visible is set to true and then gets the original date via get_original_date (sets it to a variable). If the variable is None it doesn't add a thing. It it is visible it sets the date just like in Added on and wraps it in a translation block.
The get_original_date function tries to fetch exif_all's EXIF DateTimeOriginal (and under that "printable"). Then it uses datetime.datetime's strptime to read the string into a python datetime object and returns it (this is all in a try/except statement so that if anything goes wrong it returns None.
comment:8 by , 12 years ago
Keywords: | review added |
---|
comment:9 by , 12 years ago
Related, but different: #642
532 is about showing more exif info.
642 is about having a db field for this stuff.
comment:10 by , 12 years ago
Owner: | removed |
---|---|
Status: | assigned → review |
comment:11 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | review → closed |
This is finally, finally merged! :)
You did a great job on this... it's an embarassment it took so long. The new "review queue" workflow is helping though! :)
comment:12 by , 12 years ago
Milestone: | → 0.4.0 |
---|
Proposed fix in branch 532-exif-creation-date:
https://gitorious.org/~tryggvi/mediagoblin/tryggvi-mediagoblin/commits/532-exif-creation-date