Automattic\WooCommerce\Blocks\Utils

ProductGalleryUtils::get_image_src_data │ public static │ WC 1.0

Get the image source data.

Method of the class: ProductGalleryUtils{}

No Hooks.

Returns

array. An array of image source data.

Usage

$result = ProductGalleryUtils::get_image_src_data( $image_ids, $size, $product_title );
$image_ids(array) (required)
The image IDs to retrieve the source data for.
$size(string) (required)
The size of the image to retrieve.
$product_title(string)
The title of the product used for alt fallback.
Default: ''

ProductGalleryUtils::get_image_src_data() code WC 11.1.2

public static function get_image_src_data( $image_ids, $size, $product_title = '' ) {
	$image_src_data = array();

	foreach ( $image_ids as $index => $image_id ) {
		$image_src_data[] = self::get_image_data( $image_id, $size, $product_title, $index );
	}

	return $image_src_data;
}