Automattic\WooCommerce\Blocks\Utils
ProductGalleryUtils::get_image_src_data
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() 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;
}