Opened 9 years ago
Last modified 11 months ago
#32965 new enhancement
Add new Credit field to media attachment details
Reported by: | mcuomo2013 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Media | Keywords: | phase-3-media-triage |
Focuses: | Cc: |
Description
I propose adding a new form field to the attachment details page to easily add information to credit media files to their original sources. For example, if I upload an image I can use this new field (Credit) to add the photographer and any other related or required information to fulfill copyright or attribution requirements. Currently the attachment details pane has the following fields (from Codex https://codex.wordpress.org/Inserting_Media_into_Posts_and_Pages):
- Title: the name of this media
- Caption: brief explanation - this text will be displayed below the image
- Alternative text: text to describe the media - used for accessibility
- Description: an explanation of this particular media
These fields are not ideal for adding attribution information because doing so would prevent a user from adding information originally intended for those fields. Having a separate field specifically for crediting an attachment would be better because users could still add a caption or description but also add their attribution. Plus, the Credit field could have a CSS class selector (e.g., "wp-credit-text") assigned to it to make it easy to style in a theme.
Why this is important
Whenever anyone inserts a media file into their post or page they should (or sometimes must) credit the original source. This is important to provide copyright information or to attribute items that are in the creative commons. Because there is currently no specific place to put this information on an attachment, users might not be adding it or are doing so in an inconsistent or makeshift way (e.g., in the caption field or at the end of a post).
When a user uploads a media file and sees the Credit field they may be more motivated to add the appropriate information, which can be as simple as the word "Credit" with a link to the original source to something more complex. For instance, the Creative Commons says an ideal attribution contains the following: title and author, as well as links to the original source, author's profile, and the Creative Commons license. For example:
- "Creative Commons 10th Birthday Celebration San Francisco" by tvol is licensed under CC BY 2.0. See https://wiki.creativecommons.org/wiki/Best_practices_for_attribution
Although some plugins exist that add this feature and developers can add it to their functions file, it would be more beneficial as part of the WordPress Core. It would enhance WordPress for everyone, promote the idea of attributing work, and allow theme developers to easily add or style it in themes.
Helpful things to note:
- The Credit field should allow HTML
- The magic happens in wp-admin/includes/media.php
- Current attachment form fields are added in get_attachment_fields_to_edit() (line 1164)
- WordPress creates a shortcode for the caption in img_caption_shortcode() (line 843) with <figcaption> tags and CSS class of "wp-caption-text" so we may want to do something similar to Credit, like <cite> tags and ".wp-credit-text" class.
I've developed a small plugin that adds the field, but it needs a little work with styling for the attachment editor. See some more specific notes in the plugin.
Thank you!
Attachments (1)
Change History (4)
#1
@
9 years ago
I second this. Adding the fields as you do in your plugin is fairly easy, but then using those fields on images within a post is nearly impossible. Whether or not an image has a caption, the credit should still be able to be included. If this doesn't become a part of core, there should at least be a simple way to both add and display fields for any type of media.
#2
@
9 years ago
I'd agree that giving more prominence to a credit field is generally a good move as authors and particularly photographers are more and more conscious of attribution, copyright etc.
If this info has already been added to the IPTC profile of the image (in Lightroom, Photoshop etc), then it is imported to the WordPress attachment metadata image_meta array already (https://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata for reference).
As such in the demonstration plugin you provided you'd want to be populating the form field with, and setting the value of, the attachment metadata:
$metadata = wp_get_attachment_metadata( $post->ID ); if ( isset( $metadata['image_meta']['credit'] ) ) { $field_value = $metadata['image_meta']['credit']; }
Another considerations is you'd also need to add the field to the single post edit view for the image (now normally accessed through the "Edit more details" link).
Small plugin that adds Credit field to attachment details. Needs some work.