---
title: "setPreferredIconSize"
slug: "api/catalog/operations/setpreferrediconsize"
sidebar:
  order: 214
---

<a id="ref-c44463dc30db"></a>
<a id="ref-0d988caf83fc"></a>
<a id="ref-9041d08c42d6"></a>

## Synopsis

```text
void setPreferredIconSize(SessionId sessionId, int size)
throws CatalogServiceFault;
```

See also: [SessionId](/pCon/configuratorOnline/specs/api/session/types/sessionid#ref-02e397c8fdb4), [CatalogServiceFault](/pCon/configuratorOnline/specs/api/catalog/faults/catalogservicefault#ref-f8dbfd6fd5d6)

The `setPreferredIconSize` operation can be used to tell the Online Configurator about the preferred icon size of the client. The Online Configurator interprets the `size` parameter as a hint. There is no guarantee that the icon URL returned as part of the [`CatalogItem`](/pCon/configuratorOnline/specs/api/catalog/types/catalogitem) structure references an image of the specified size.

The current implementation of the Online Configurator interprets the size parameter as follows: If the preferred icon size has not been explicitly set, or has been set to zero, then the base name of the image directory is `image`. Otherwise (if the preferred icon size has been set to a positive value), the name of the icon directory is the concatenation of `image`, the dot character (`.`), and the requested icon size, formatted as a decimal integer consisting of at least four decimal digits (the necessary number of zeros (`0`) is prepended if the preferred icon size is less than one thousand).

Furthermore, if `$data` is the data directory of the catalog package, `manu`, `prog`, `DR`, and `n` are the OFML manufacturer, program, distribution region and major version number of the catalog package, and `$image` is the base name of the image directory as selected above, then the Online Configurator uses  `$data/manu/prog/DR/n/$image` as the directory containing the image files for catalog items of this catalog package.

If this image directory exists, then the Online Configurator returns an icon URL as part of the [`CatalogItem`](/pCon/configuratorOnline/specs/api/catalog/types/catalogitem) structure that references the icon file (whose base name is read from the catalog database) within the image directory. If the image directory does not exist[^1], the Online Configurator returns an empty string instead.

**Note:** By convention, the maximum of width and height in pixels of each icon image stored in an image directory for a particular preferred icon size should be equal to the preferred icon size.

A [`CatalogServiceFault`](/pCon/configuratorOnline/specs/api/catalog/faults/catalogservicefault) is returned if any of the following conditions occurs:

- The `sessionId` parameter is not a valid string representation of an UUID or does not represent an open session.

- The `size` parameter is negative.

[^1]: Whether or not the icon file itself exists has no effect.
