Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks

Product_Image::extract_image_heightprivateWC 1.0

Extract image height from HTML for positioning calculations.

Method of the class: Product_Image{}

No Hooks.

Returns

float. Image height in pixels.

Usage

// private - for code of main (parent) class only
$result = $this->extract_image_height( $image_html ): float;
$image_html(string) (required)
Image HTML.

Product_Image::extract_image_height() code WC 10.4.3

private function extract_image_height( string $image_html ): float {
	$height = ( new Dom_Document_Helper( $image_html ) )->get_attribute_value_by_tag_name( 'img', 'height' ) ?? '';
	if ( $height ) {
		return Styles_Helper::parse_value( $height );
	}

	return 300;
}