# Google Cloud Retail V2 Client - Class Image (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.1 2.2.1 2.1.3 2.0.0 1.7.0 1.6.4 1.5.0 1.4.2 1.3.1 1.2.1 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Retail V2 Client class Image.

[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) image. Recommendations AI and
Retail Search use product images to improve prediction and search results.

Product images can be returned in results, and are shown in prediction or
search previews in the console. Please try to provide correct product images
and avoid using images with size too small.

Generated from protobuf message `google.cloud.retail.v2.Image`

## Namespace

Google \\ Cloud \\ Retail \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ uri` | `string` Required. URI of the image. This field must be a valid UTF-8 encoded URI with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned. Google Merchant Center property [image_link](https://support.google.com/merchants/answer/6324350). Schema.org property [Product.image](https://schema.org/image). |
| `↳ height` | `int` Height of the image in number of pixels. This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned. |
| `↳ width` | `int` Width of the image in number of pixels. This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned. |

### getUri

Required. URI of the image.

This field must be a valid UTF-8 encoded URI with a length limit of 5,000
characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property
[image_link](https://support.google.com/merchants/answer/6324350).
Schema.org property [Product.image](https://schema.org/image).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setUri

Required. URI of the image.

This field must be a valid UTF-8 encoded URI with a length limit of 5,000
characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property
[image_link](https://support.google.com/merchants/answer/6324350).
Schema.org property [Product.image](https://schema.org/image).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getHeight

Height of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
returned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setHeight

Height of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
returned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getWidth

Width of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
returned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setWidth

Width of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
returned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |