# Javascript: ImageCollection.getItemByName Method

> Gets the image with the specified name.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: ImageCollection.getItemByName Method
- **382 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/imagecollection/getitembyname-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/imagecollection/getitembyname-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/imagecollection/getitembyname-method/llms-full.txt

---

### Description

Gets the image with the specified name.

### Syntax

```javascript
<void> ImageCollection.getItemByName(<RequestImageCallback> callback, [<ErrorCallback> errorCallback], <string> name)
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the requested image or null if no image with the specified name exists. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| name | The image's name. |

### Examples

The following example demonstrates `ImageCollection.getItemByName` in a practical document-editing workflow. It gets the image with the specified name.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.images.getItemByName(
    function(image) {
        if (!image) {
            console.warn("No image was returned.");
            return;
        }
        
        console.log("get item by name result:", image);
    },
    onTxError,
    "CompanyLogo"
);
```

---

## Nearby

- **Previous:** [Javascript: ImageCollection.getItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/imagecollection/getitem-method/llms-full.txt)
- **Next:** [Javascript: ImageCollection.remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/imagecollection/remove-method/llms-full.txt)
