<p><a href="https://craftcms.com/classreference/models/AssetFileModel" rel="nofollow">AssetFileModel</a>'s <a href="https://craftcms.com/classreference/models/AssetFileModel#getPath-detail" rel="nofollow">getPath</a> should do what you're looking for.</p>

<pre><code>&lt;img ix-path="{{ asset.getPath() }}" alt="Test Image"&gt;
</code></pre>

CC BY-SA 3.0
2016-07-27T19:24:56.483Z
For some reason that isn't including the folder in the path, just the filename
Dan Christian
CC BY-SA 3.0
2016-07-27T19:43:15.603Z
If it's just the filename, then that means the file is in the root of your Asset source path.
Brad Bell
CC BY-SA 3.0
2016-07-27T19:45:35.650Z
Yes, your answer is correct, there is something wrong with the asset folder I think.
Dan Christian
CC BY-SA 3.0
2016-07-27T00:10:08.700Z
2016-07-27T00:10:08.700Z
Brad Bell
<p>I am using a 3rd party service to run the image processing so I do not need full URL's for the images. I just need it to spit out the relative path name of the asset, not the absolute URL. I seem to be able to get either the <code>asset.folder</code> or the <code>asset.filename</code> but not both.</p>

<pre><code>{% if entry.homepageImage|length %}
{% set asset = entry.homepageImage.first() %}
  &lt;img ix-path="{{ asset.filename }}" alt="Test Image"&gt;
{% endif %}
</code></pre>

<p>I did try including the folder when setting the asset but that didn't work either, plus seems quite convoluted for something relatively simple.</p>

<pre><code>{% set asset = entry.homepageImage.folderId(2).first() %}
</code></pre>

<assets>
Get asset folder and filename together
# Get asset folder and filename together

(Asked by: username_0 on 2016-07-26)

I am using a 3rd party service to run the image processing so I do not need full URL's for the images. I just need it to spit out the relative path name of the asset, not the absolute URL. I seem to be able to get either the asset.folder or the asset.filename but not both.
{% if entry.homepageImage|length %}
{% set asset = entry.homepageImage.first() %}
  
{% endif %}

I did try including the folder when setting the asset but that didn't work either, plus seems quite convoluted for something relatively simple.
{% set asset = entry.homepageImage.folderId(2).first() %}

**Tags:** assets


---

## 1 answers

### Answer by username_1 on 2016-07-27. Score: 1 | Accepted answer

AssetFileModel's getPath should do what you're looking for.

> **Comments:**
> **username_0**: For some reason that isn't including the folder in the path, just the filename  
> **username_1**: If it's just the filename, then that means the file is in the root of your Asset source path.  
> **username_0**: Yes, your answer is correct, there is something wrong with the asset folder I think.  

---

