# Camera Details Box for Photos

> Adds a "Camera details" box to the media edit screen showing the camera, lens settings, ISO, shutter speed, focal length and date taken that WordPress read from the photo.

- Type: PHP
- Runs: Admin only
- Category: [Media](https://wpide.com/library/category/media/)
- Tags: exif, photography, media-library
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/media-camera-details-box/

## Code

```php
add_action( 'add_meta_boxes_attachment', function ( $post ) {
    if ( ! wp_attachment_is_image( $post ) ) {
        return;
    }
    add_meta_box( 'wpide-camera-details', 'Camera details', function ( $post ) {
        $meta = wp_get_attachment_metadata( $post->ID );
        $info = $meta['image_meta'] ?? array();

        $rows = array(
            'Camera'        => $info['camera'] ?? '',
            'Aperture'      => ! empty( $info['aperture'] ) ? 'f/' . $info['aperture'] : '',
            'Shutter speed' => ! empty( $info['shutter_speed'] ) ? ( $info['shutter_speed'] < 1 ? '1/' . round( 1 / $info['shutter_speed'] ) : $info['shutter_speed'] ) . ' s' : '',
            'ISO'           => $info['iso'] ?? '',
            'Focal length'  => ! empty( $info['focal_length'] ) ? $info['focal_length'] . ' mm' : '',
            'Taken'         => ! empty( $info['created_timestamp'] ) ? wp_date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), (int) $info['created_timestamp'] ) : '',
            'Copyright'     => $info['copyright'] ?? '',
        );
        $rows = array_filter( $rows, 'strlen' );

        if ( ! $rows ) {
            echo '<p>No camera data stored for this image.</p>';
            return;
        }
        echo '<table class="widefat striped"><tbody>';
        foreach ( $rows as $label => $value ) {
            printf( '<tr><th scope="row">%s</th><td>%s</td></tr>', esc_html( $label ), esc_html( $value ) );
        }
        echo '</tbody></table>';
    }, 'attachment', 'side', 'low' );
} );
```

## Notes

Only shows values that were in the file at upload time; photos stripped of metadata show nothing.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Camera Details Box for Photos" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
