ID.php
10 years ago
actions.php
10 years ago
alternate-text.php
10 years ago
attached-to.php
10 years ago
available-sizes.php
10 years ago
caption.php
10 years ago
description.php
10 years ago
dimensions.php
10 years ago
exif-data.php
10 years ago
file-name.php
10 years ago
file-size.php
10 years ago
full-path.php
10 years ago
height.php
10 years ago
mime-type.php
10 years ago
width.php
10 years ago
dimensions.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * CPAC_Column_Media_Dimensions |
| 4 | * |
| 5 | * @since 2.0 |
| 6 | */ |
| 7 | class CPAC_Column_Media_Dimensions extends CPAC_Column { |
| 8 | |
| 9 | /** |
| 10 | * @see CPAC_Column::init() |
| 11 | * @since 2.2.1 |
| 12 | */ |
| 13 | public function init() { |
| 14 | |
| 15 | parent::init(); |
| 16 | |
| 17 | // Properties |
| 18 | $this->properties['type'] = 'column-dimensions'; |
| 19 | $this->properties['label'] = __( 'Dimensions', 'codepress-admin-columns' ); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * @see CPAC_Column::get_value() |
| 24 | * @since 2.0 |
| 25 | */ |
| 26 | public function get_value( $id ) { |
| 27 | |
| 28 | $value = ''; |
| 29 | |
| 30 | $meta = $this->get_raw_value( $id ); |
| 31 | |
| 32 | if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { |
| 33 | $value = "{$meta['width']} x {$meta['height']}"; |
| 34 | } |
| 35 | |
| 36 | return $value; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @see CPAC_Column::get_raw_value() |
| 41 | * @since 2.3.2 |
| 42 | */ |
| 43 | public function get_raw_value( $id ) { |
| 44 | |
| 45 | return get_post_meta( $id, '_wp_attachment_metadata', true ); |
| 46 | } |
| 47 | } |