<p>Of course it is. You can get the volume as you want, for example</p>

<pre class="lang-twig prettyprint-override"><code>{% set volume = craft.app.getVolumes().getVolumeByHandle('images') %}
</code></pre>

<p>Of if you have an asset</p>

<pre class="lang-twig prettyprint-override"><code>{% set asset = craft.assetFieldHandly.one() %}
{% set volume = asset.getVolume() %}
</code></pre>

<p>And output the information</p>

<pre class="lang-twig prettyprint-override"><code>{{ volume.path }}
{{ volume.id }}
</code></pre>

<p>if <code>{{ volume.path }}</code> contains an alias you can do <code>{{ alias(volume.path) }}</code> to display the resolved path</p>

CC BY-SA 4.0
2018-08-12T13:57:15.173Z
2018-08-12T13:57:15.173Z
Robin Schambach
<p>Is it possible to get the location (/media) and id (1) of an asset volume from within a Craft template?</p>

<templating>
Get the location and id of asset volumne
# Get the location and id of asset volumne

(Asked by: username_0 on 2018-08-12)

Is it possible to get the location (/media) and id (1) of an asset volume from within a Craft template?

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2018-08-12. Score: 1 | Accepted answer

Of course it is. You can get the volume as you want, for example
{% set volume = craft.app.getVolumes().getVolumeByHandle('images') %}

Of if you have an asset
{% set asset = craft.assetFieldHandly.one() %}
{% set volume = asset.getVolume() %}

And output the information
{{ volume.path }}
{{ volume.id }}

if {{ volume.path }} contains an alias you can do {{ alias(volume.path) }} to display the resolved path


---

