image pathing fixed on tgiann

this -- "nui://inventory_images/html/images/%s.png"
Is not the path, it its instead
nui://inventory_images/images/%s.png"

Also strip webp function added. And indexing itemdata was required.
This commit is contained in:
MrNewb committed 2025-08-03 16:23:19 -04:00
1 parent fa9ea6e6eb
commit 5abebe13c6
4 files changed
+30 -10

No files matched your search

@@ -200,18 +200,18 @@ Inventory.ClearStash = function(id, _type)
return true
end
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
---This will get the image path for this item, if not found will return placeholder.
---@param item string
---@return string
Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item))
local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item))
local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item)
local pngItem = Inventory.StripPNG(item)
local webpItem = Inventory.StripWebp(item)
local pngPath = LoadResourceFile("inventory_images", string.format("/images/%s.png", pngItem))
local webpPath = LoadResourceFile("inventory_images", string.format("/images/%s.webp", webpItem))
local imagePath = pngPath and string.format("nui://inventory_images/images/%s.png", pngItem) or webpPath and string.format("nui://inventory_images/images/%s.webp", webpItem)
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end
---UNUSED:
---This will return generic item data from the specified inventory, with the items total count.
---