Access Images from other resource in NUI HTML

Hi

I would like to know if it is possible to use the images of a resource in another resource.
I my case I use esx_inventoryhud where every item has an image that is located under ‘html/img/items/*.png’. I want to reused these same images in another resource.
I dont really want to copy the whole images folder to my new resource, because then I would have to keep the item images up to date in two places.

So far I have tried 3 ideas. These have all failed.

  1. using relative paths
    in my fxmanifest under files I added: ‘…/…/[esx]/esx_inventoryhud/html/img/items/’*.png’
    which is the correct relative path in my case (it works when clicking on it in vs code)

when trying to access the files in multiple ways in my html it didnt work

  1. using @
    I noticed that many resource include other scripts with something like this: ‘@es_extended/locale.lua’
    So I tried the same with the image folder: ‘@esx_inventoryhud/html/img/items/*.png’

But this also didnt work when trying to access the files in multiple ways in my html

  1. using Windows shortcuts
    I tried creating a windows shortcut to the image directory of esx_inventoryhud
    Then I moved the shortcut to my resource, renamed it, and added it to fxmanifest like so: ‘html/itemImages/*.png’

This also didnt work when trying to access the iamges in html

When I simply copy the images folder to my resource and add the folder to fxmanifest like: ‘html/itemImages/*.png’ everything works as expected
I can access the images in html like this: ‘

Do you guy have any idea what else I could try to get this to work?
Best regards

2 Likes

I know this is crazy old, but did you ever figure out how to do it? I’m also trying to achieve the same thing, and I previously tried the 3 methods you did to no success either.

EDIT: Of course right after necro’ing I find the answer in another thread… However, since this was the first result when I googled for my solution, I will reiterate the solution I found that worked from this thread:

Try using nui://resourcename/client/html/assets/icons/blalalalaala.png

i belive what your looking for is

https://cfx-nui-"resourcename"/"somepath"/"somefile".png
ex https://cfx-nui-qb-inventory/html/images/weapon_pistol.png

for more info read Fullscreen NUI - Cfx.re Docs