For the complete documentation index, see llms.txt. This page is also available as Markdown.

Images Settings

This page explains how to configure item images, add custom graphics, and manage image paths in Koja-Crafting.


πŸ”§ Configuration Options

All image settings are located in shared/config.lua under the IMAGES SETTINGS section.

-- ════════════════════════════════════════════════════════════════════════════════════
--  IMAGES SETTINGS
-- ════════════════════════════════════════════════════════════════════════════════════

Config.Images = {
    globalImagesPath = 'default',
    format = 'webp'
}

πŸ“ Setting Descriptions

Global Images Path

globalImagesPath = 'default'

Purpose: Define where item images are loaded from - either local crafting images or external inventory images.

Options:

Value
Description
Use Case

'default'

Uses images from koja-crafting/web/build/images/

Default, uses built-in images

'nui://inventory/html/images/'

Links to QB inventory

QBCore servers using qb-inventory

'nui://ox_inventory/web/build/images/'

Links to ox_inventory

ESX/Standalone using ox_inventory

Custom path

Any NUI resource path

Custom inventory systems

How it works:

  • The path is prepended to all item image paths

  • Allows using existing inventory images

  • No need to duplicate images across resources


Image Format

Purpose: Specify the file extension for item images.

Options:

  • 'webp' - Modern format, smaller file size, faster loading (recommended)

  • 'png' - Traditional format, wider compatibility, larger files

When to use each:

  • βœ… Use 'webp' if your inventory uses WebP format

  • βœ… Use 'png' if your inventory uses PNG format

  • βœ… Match your inventory system's format for consistency


🎨 Image Path System

How Image Paths Work

There are two ways to define item images in your crafting configuration:

Method 1: Relative Path

Method 2: Absolute Path


πŸ”„ Configuration Examples

Example 1: Using Default Built-in Images

Result: Loads from koja-crafting/web/build/images/bandage.webp


Example 2: Using ox_inventory Images

Result: Loads from ox_inventory/web/images/bandage.png


Example 3: Using qb-inventory Images

Result: Loads from qb-inventory/html/images/bandage.png


Example 4: Mixed Sources

Result:

  • bandage loads from ox_inventory

  • custom_item loads from koja-crafting local images


πŸ“ Adding Custom Images

Step-by-Step Guide

1
  1. Prepare your image:

    • Recommended size: 256x256px or 512x512px

    • Format: .webp (smaller) or .png

    • Transparent background recommended

    • File naming: lowercase, no spaces (e.g., my_item.webp)

  2. Add image to folder:

  3. Configure in config.lua:

  4. Restart resource:

2

Option B: Use External Inventory Images

  1. Set global path:

  2. Ensure image exists in inventory:

  3. Reference in config:


🎯 Best Practices

Image Optimization

  1. Use WebP format when possible:

    • 25-35% smaller than PNG

    • Faster loading times

    • Better performance

  2. Optimize file size:

    • Keep images under 100KB each

    • Use compression tools

    • Remove unnecessary metadata

    • Use appropriate resolution (256x256 or 512x512)

  3. Consistent naming:

  1. Transparent backgrounds:

    • Better visual integration

    • Professional appearance

    • Matches inventory style


File Organization (Optional)

Organize images by category for easier management:

Then reference with subdirectories:


πŸ” Troubleshooting

Images Not Showing

Problem: White/blank squares instead of images

Solutions:

  1. Check file exists in correct location

  2. Verify file extension matches config

  3. Check for typos in image path

  4. Ensure image format is supported (webp/png)

  5. Clear FiveM cache (client)

  6. Restart resource after adding images


  • For item configuration, see Crafting Stations

  • For resource management, see Server Settings

  • For general setup, see Installation

Last updated