wp_get_attachment_id3_keys( WP_Post $attachment, string $context = 'display' ): string[]

In this article

Returns useful keys to use to lookup data from an attachment’s stored metadata.

Parameters

$attachmentWP_Postrequired
The current attachment, provided for context.
$contextstringoptional
The context. Accepts 'edit', 'display'. Default 'display'.

Default:'display'

Return

string[] Key/value pairs of field keys to labels.

Source

			$width  = $default_width;
			$height = $default_height;
		}

		$track['dimensions'] = array(
			'original' => compact( 'width', 'height' ),
			'resized'  => array(
				'width'  => $theme_width,
				'height' => $theme_height,
			),
		);
	}
}

if ( $atts['images'] ) {
	$thumb_id = get_post_thumbnail_id( $attachment->ID );
	if ( ! empty( $thumb_id ) ) {
		list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' );
		$track['image']               = compact( 'src', 'width', 'height' );
		list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' );
		$track['thumb']               = compact( 'src', 'width', 'height' );
	} else {
		$src            = wp_mime_type_icon( $attachment->ID, '.svg' );
		$width          = 48;
		$height         = 64;
		$track['image'] = compact( 'src', 'width', 'height' );

Changelog

VersionDescription
3.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.