Do any plugins exist for WordPress that allow me to attach extra meta data to images?
From the media section in WordPress, I can see that I can edit
- Title
- Alternate text
- Ca开发者_Go百科ption
- Description
I need to add extra data, like shutter speed, location & film.
Short of something like title: "bla bla", shutterSpeed: "4"
in the description field (and parsing it), is there any plugin that adds this functionality?
It should be easy enough for a laymen to enter data into.
Thanks!
WordPress will store any EXIF data it can retrieve at point-of-upload into the attachment metadata array (which is serialized in the postmeta
table under the key _wp_attachment_metadata
).
You can retrieve this metadata using wp_get_attachment_metadata($attachment_ID)
.
To add your own fields to the edit attachment form, check out get_attachment_fields_to_edit()
in wp-admin/includes/media.php
(line 1034
as of 3.0).
You can filter attachment_fields_to_edit
, passing back a structured array like so;
function add_my_attachment_field($fields, $post)
{
$fields['my_field'] = array(
'label' => 'My Label',
'input' => 'html',
'html' => "<input type='text' class='text' name='my_field' value='my_value' />",
'value' => 'my_value',
'helps' => 'Helper text'
);
return $fields;
}
add_filter('attachment_fields_to_edit', 'add_my_attachment_field', 10, 2);
NG Gallery can extract metadata from the EXIF data in the image and you have title/description fields as well
精彩评论