# Image selector

The image selector enables you to display and retrieve one or several selected images.

Using the image selector, you can:

* Select and deselect images
* Upload images by either selecting them from a list, or using drag and drop
* Search for images in the currently opened library or in all libraries
* Select the provider from which to retrieve images
* Filter images by *Libraries*, *Categories*, *Tags*, or *Dates*
* Sort images by *Title*, *Date created*, or *Date modified*

> info **NOTE**: You can change the image selector's behavior by editing its properties in the *Advanced* settings section.

The images you select are stored in a scope `array` variable. The default template visualizes images using the `sfCollection` directive. For more information, see [Use a generic collection directive](https://www.progress.com/documentation/sitefinity-cms/use-a-generic-collection-directive-mvc).

You can use the image selector in the frontend, as well as in the backend. For example, on a page, as well as in a widget designer.

The `sfImageSelector` is a directive with an isolated scope that is defined in a module with the same name: `sfImageSelector`. For more information, see [AngularJS Isolated scope](http://docs.angularjs.org/guide/directive#isolating-the-scope-of-a-directive).

The following image is an example of an image selector:

[![Image title](https://www.progress.com/documentation/sitefinity-cms/assets/d559c3dff4ecea6aab729d3c23c80717/sfimageselector.png)](https://www.progress.com/documentation/sitefinity-cms/assets/d559c3dff4ecea6aab729d3c23c80717/sfimageselector.png)

In your `DesignerView.YourView.cshtml` file, place one of the following tags anywhere in the HTML code:

```Razor
@using Telerik.Sitefinity.Frontend.Mvc.Helpers
<div><label>Choose an image: </label>

    <sf-image-field class="sf-Media--info modal-settings"	    sf-model="properties.ImageId.PropertyValue" 
                    sf-provider="properties.ImageProviderName.PropertyValue"
                    sf-auto-open-selector
                    sf-media-settings="@SettingsHelpers.GetMediaSettings("Image")" ></sf-image-field>

</div>
```

The values of the attributes are scope properties that you define in the MVC widget controller.

<table>
<tbody>
<tr>
<th>Attribute</th>
<th>Description</th>
</tr>
<tr>
<td>

`sf-model`

</td>
<td>

Accepts a scope variable that holds the selected items.

</td>
</tr>
<tr>
<td>

`sf-filter`

</td>
<td>

Accepts a filter object to use when filtering displayed items.

</td>
</tr>
<tr>
<td>

`sf-provider`

</td>
<td>

Accepts a provider name to use when retrieving the items to display.

</td>
</tr>
<tr>
<td>

`sf-template-url`

</td>
<td>

Allows you to override the template of the image selector.

</td>
</tr>
<tr>
<td>

`sf-template-assembly`

</td>
<td>

Specifies the assembly where the template of the image selector is located

</td>
</tr>
<tr>
<td>

`sf-master`

</td>
<td>

Defines whether the selector displays images and their statuses, such as *Draft*, *Locked*, and so on, or only published images. To configure the <em>Images</em> selector to display master items, that is, all images, independently of their status, set the `sf-master="true"`. By default, the selector displays only live images and the value of the `sf-master` is set to `false`.

> info  **NOTE**: When you set the `sf-master="true"`, the selectors lists the items but does not display their status.

</td>
</tr>
</tbody>
</table>

You can modify the settings of the `sf-image-selector` component directly. To do this, edit the `sf-image-field.sf-cshtml` file and change the following line:

```HTML
<sf-image-selector
    sf-model="model.selectedItems"
    sf-filter="model.filterObject"
    sf-provider="model.provider"
    sf-media-settings="sfMediaSettings">
</sf-image-selector>
```
