Displaying EXIF data in a separate WordPress column, in the Media section
I think everyone who uses WordPress for galleries, portfolio and simple, to show your photos, this code snippet should be helpful. We'll talk about EXIF data. Data, that the device leaves when shooting, or program, when editing. Displaying EXIF data in a separate WordPress column, in the Media section, you can implement, adding code to function.php file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
add_filter('manage_media_columns', 'posts_columns_attachment_exif', 1); add_action('manage_media_custom_column', 'posts_custom_columns_attachment_exif', 1, 2); function posts_columns_attachment_exif($defaults){ $defaults['wps_post_attachments_exif'] = __('EXIF'); return $defaults; } function posts_custom_columns_attachment_exif($column_name, $id){ if($column_name === 'wps_post_attachments_exif'){ $meta = wp_get_attachment_metadata($id); if($meta[image_meta][camera] != ''){ echo "CR: ".$meta[image_meta][credit]."<hr />"; echo "CAM: ".$meta[image_meta][camera]."<hr />"; echo "FL: ".$meta[image_meta][focal_length]."<hr />"; echo "AP: ".$meta[image_meta][aperture]."<hr />"; echo "ISO: ".$meta[image_meta][iso]."<hr />"; echo "SS: ".$meta[image_meta][shutter_speed]."<hr />"; echo "TS: ".$meta[image_meta][created_timestamp]."<hr />"; echo "C: ".$meta[image_meta][copyright]; } } } |
As far as I understand, with Exif data, the snippet outputs the camera model, focal length at which the picture was taken, endurance, timestamp, Copyright (credit, camera, focal length, aperture, iso, shutter speed, timestamp, copyright).
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.