# Ember retrieve image through didInsertElement

**URL:** <https://discuss.emberjs.com/t/ember-retrieve-image-through-didinsertelement/11567>\
**Category:** Uncategorized\
**Created:** [September 14, 2016, 7:40am UTC](https://discuss.emberjs.com/t/ember-retrieve-image-through-didinsertelement/11567 "2016-09-14T07:40:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon74886000](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@anon74886000](https://discuss.emberjs.com/u/anon74886000)\
**Post date:** [September 14, 2016, 7:40am UTC](https://discuss.emberjs.com/t/ember-retrieve-image-through-didinsertelement/11567/1 "2016-09-14T07:40:20Z")

</div>

Hi, I have an Ember application that use select2. I have to punt inside the select2 the flags associated with the nation but when I upload the dist folder on apache the image is stored like

Language1-4caa60355ba79094264c91e5c3c921fa.png

so in my didInsertElement

` '<span><img src="assets/flag/' + state.id + '.png" class="img-flag" /> ' + state.text + '</span>'`

where state.id is Language1 but when I make the build… ember add to image 4caa60355ba79094264c91e5c3c921fa.png. So who can I retrieve the image?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![workmanw](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/workmanw/32/14929_2.png) [@workmanw](https://discuss.emberjs.com/u/workmanw)\
**Post date:** [September 19, 2016, 11:57pm UTC](https://discuss.emberjs.com/t/ember-retrieve-image-through-didinsertelement/11567/2 "2016-09-19T23:57:28Z")

</div>

Checkout [https://github.com/rickharrison/broccoli-asset-rev](https://github.com/rickharrison/broccoli-asset-rev) . This is what’s actually doing the fingerprinting. It does optionally dump out a JSON file of all the fingerprinted files, you could use that to determine your path.

The other option is if you use literals, the broccoli-asset-rev addon will actually replace them in JS. So if that was: `<img src="assets/flag/Language1.png" class="img-flag" />` it would actually be replaced. I’m guessing the `state.id` is dynamic, but perhaps you could create a map:

```javascript
const ASSET_FILE_PATHS = {
  'Language1': '/Language1.png'
};

```

```auto
`<img src="assets/flag/${ASSET_FILE_PATHS[state.id]}" class="img-flag" />`

```

`
