1

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() %}
  <img ix-path="{{ asset.filename }}" alt="Test Image">
{% 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() %}
1

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

<img ix-path="{{ asset.getPath() }}" alt="Test Image">
| improve this answer | |
  • For some reason that isn't including the folder in the path, just the filename – Dan Christian Jul 27 '16 at 19:24
  • If it's just the filename, then that means the file is in the root of your Asset source path. – Brad Bell Jul 27 '16 at 19:43
  • Yes, your answer is correct, there is something wrong with the asset folder I think. – Dan Christian Jul 27 '16 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.