[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/admin](../../README) / [index](../README) / mediaUrl

# Function: mediaUrl()

> **mediaUrl**(`item`, `disk?`): `Promise`\<`string` \| `null`\>

Defined in: [admin/src/media.ts:142](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/admin/src/media.ts#L142)

A URL the browser can fetch for a catalogued file, or `null` when the disk
has none.

`null`, not the stored path. Returning the path produced a *relative* `src`
that the browser resolved against whatever admin page was open — a media
library at `/admin/shop/media` asking for `media/photo.jpg` fetched
`/admin/shop/media/media/photo.jpg` and got the panel's own 404. A caller
that knows there is no URL can render a placeholder; one handed a broken
string cannot.

## Parameters

### item

[`MediaItem`](../interfaces/MediaItem)

### disk?

`string`

## Returns

`Promise`\<`string` \| `null`\>
