# image/imageresize/utils/getselectedimagewidthinunits

module

<a id="functions">

## Functions

<a id="function-getSelectedImageWidthInUnits">

### `getSelectedImageWidthInUnits( editor, targetUnit ) → DimensionWithUnit | null` _(internal)_

Returns image width in specified units. It is width of image after resize.

```
* If image is not selected or command is disabled then `null` will be returned.
* If image is not fully loaded (and it is impossible to determine its natural size) then `null` will be returned.
* If `targetUnit` percentage is passed then it will return width percentage of image related to its accessors.
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-image/src/imageresize/utils/getselectedimagewidthinunits.ts#L28)

#### Parameters

* `editor: Editor`

  Editor instance.

* `targetUnit: string`

  Unit in which dimension will be returned.

#### Returns

* `DimensionWithUnit | null`

  Parsed image width after resize (with unit).

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
