WC_Regenerate_Images::get_full_size_image_dimensions()private staticWC 1.0

Get full size image dimensions.

Method of the class: WC_Regenerate_Images{}

No Hooks.

Return

Array. Width and height. Empty array if the dimensions cannot be found.

Usage

$result = WC_Regenerate_Images::get_full_size_image_dimensions( $attachment_id );
$attachment_id(int) (required)
Attachment ID of image.

WC_Regenerate_Images::get_full_size_image_dimensions() code WC 8.9.0

private static function get_full_size_image_dimensions( $attachment_id ) {
	$imagedata = wp_get_attachment_metadata( $attachment_id );

	if ( ! is_array( $imagedata ) ) {
		return array();
	}

	if ( ! isset( $imagedata['file'] ) && isset( $imagedata['sizes']['full'] ) ) {
		$imagedata['height'] = $imagedata['sizes']['full']['height'];
		$imagedata['width']  = $imagedata['sizes']['full']['width'];
	}

	return array(
		'width'  => $imagedata['width'],
		'height' => $imagedata['height'],
	);
}