# woocommerce-pos/1.10.0/includes/Sync/Product_Images.php

WCPOS – Point of Sale (POS) plugin for WooCommerce, version 1.10.0. 54 lines.

- Page: https://pluginprobe.com/plugins/woocommerce-pos/1.10.0/code/includes/Sync/Product_Images.php
- Raw: https://pluginprobe.com/plugins/woocommerce-pos/1.10.0/raw/includes/Sync/Product_Images.php
- Modified: 2026-08-25T07:52:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woocommerce-pos/1.10.0/code/includes/Sync/Product_Images.php#L10-L20`.

```php
<?php
/**
 * WCPOS sync read surface.
 *
 * @package WCPOS\WooCommercePOS\Sync
 */

namespace WCPOS\WooCommercePOS\Sync;

/**
 * Serves medium product images across catalog read surfaces.
 */
final class Product_Images {
	/**
	 * THE image augmentation, registered ONCE with {@see Augmentation_Pipeline}
	 * and projected onto both read lanes: replace full-size product image URLs
	 * with their WordPress medium size.
	 *
	 * @param mixed      $payload Serialized product record.
	 * @param null|mixed $object  Product object, when the lane has one loaded.
	 * @param null|mixed $request Request context.
	 */
	public static function augment_record( $payload, $object = null, $request = null ) {
		if ( ! \is_array( $payload ) ) {
			return $payload;
		}

		return self::downsize_images( $payload );
	}

	/**
	 * Replace each image source with its medium URL when available.
	 *
	 * @param array $record Product response record.
	 */
	private static function downsize_images( array $record ): array {
		if ( ! isset( $record['images'] ) || ! \is_array( $record['images'] ) ) {
			return $record;
		}
		foreach ( $record['images'] as $index => $entry ) {
			if ( ! \is_array( $entry ) || ! isset( $entry['id'] ) || 0 >= (int) $entry['id'] ) {
				continue;
			}
			$medium = image_downsize( (int) $entry['id'], 'medium' );
			if ( $medium ) {
				$entry['src']                = $medium[0];
				$record['images'][ $index ] = $entry;
			}
		}

		return $record;
	}
}

```
