# Sage: Displaying images in assets / images folder

**URL:** https://discourse.roots.io/t/sage-displaying-images-in-assets-images-folder/3206
**Category:** uncategorized
**Created:** 2015-03-12T18:30:17Z
**Posts:** 31
**Showing post:** 26 of 31

## Post 26 by @alwaysblank — 2019-07-24T17:49:04Z

> [@trainoasis](#):
>
> Related to `asset_path()` , that’s why I did not open a new ticket: **is there an option to check for file existence first?**

Not as part of `asset_path()` no, I don’t believe so. You can check out the code behind it right here: [https://github.com/roots/sage-lib/blob/master/Assets/JsonManifest.php](https://github.com/roots/sage-lib/blob/master/Assets/JsonManifest.php)

I’ve never needed to determine existence of an asset, but I have needed to get the absolute path (i.e. for embedding SVGs), and I used the following technique:

```
// in /theme/config/assets.php add the following to the array:

'path' => get_theme_file_path().'/dist',

// in `app/helpers.php` add the following:

/**
 * Get the absolute path to an asset.
 *
 * @param string $asset
 * @return string
 */
function locate_asset($asset)
{
    return trailingslashit(config('assets.path')) . sage('assets')->get($asset);
}

// Now you can do something like this:

/**
 * Determine if asset exists.
 *
 * @param string $asset
 * @return bool
 */
function asset_exists($asset)
{
    return file_exists(locate_asset($asset));
}
```

---

_[View the full topic](https://discourse.roots.io/t/sage-displaying-images-in-assets-images-folder/3206)._
