Redutzu's Scripts
  • â„šī¸Information
  • 🛒Store
  • đŸ’ģDiscord
  • 📚Resources
    • Redutzu MDT
      • Installation
      • Guides
        • Frameworks
        • Items
        • Localization
        • Images
        • Logs
        • Permissions
        • Bodycam
      • Exports/Events
        • Server Events
          • addDispatchToMDT
        • Server Exports
          • Incidents
          • Evidences
          • Warrants
          • Bolos
          • Citizens
          • Vehicles
          • Codes
          • Charges
          • Weapons
          • Announcements
          • Tags
        • Client Events
          • Open/Close MDT
        • Client Exports
      • Common Issues
    • Redutzu EMS
      • Installation
      • Guides
      • Exports
    • Redutzu Documents
      • Installation
      • Guides
      • Exports
Powered by GitBook
On this page
  • Upload Configuration Explanation
  • Main Configuration
  • Upload Methods Configuration

Was this helpful?

  1. Resources
  2. Redutzu MDT
  3. Guides

Images

upload.lua

Upload Configuration Explanation

The Upload configuration allows you to set up image uploading for your MDT system. You can choose between different upload methods: Discord, Imgur, FiveManage, or a custom solution.

Main Configuration

Upload = {}
Upload.Method = 'fivemanage'  -- Options: 'discord', 'imgur', 'fivemanage', 'custom'

Upload.Method specifies which upload service to use. Set this to one of the available options.

Upload Methods Configuration

Each upload method has its own configuration:

Upload.Methods = {
    ['discord'] = { ... },
    ['imgur'] = { ... },
    ['fivemanage'] = { ... },
    ['custom'] = { ... }
}

Discord Upload

['discord'] = {
    link = 'https://discord.com/api/webhooks/',  -- Your webhook link
    field = 'files[]',
    path = 'attachments.1.url',
    options = {
        encoding = 'webp'  -- Options: 'webp', 'png', 'jpg'
    }
}

To set up Discord uploading:

  1. Create a webhook in your Discord server.

  2. Replace 'https://discord.com/api/webhooks/' with your full webhook URL.

  3. Choose an encoding format ('webp' for smaller file sizes, or 'png'/'jpg' for different formats).

Example:

['discord'] = {
    link = 'https://discord.com/api/webhooks/123456789/abcdefghijklmnop',
    field = 'files[]',
    path = 'attachments.1.url',
    options = {
        encoding = 'png'
    }
}

Imgur Upload

['imgur'] = {
    link = 'https://api.imgur.com/3/upload',
    field = 'image',
    path = 'data.link',
    options = {
        headers = {
            ['Authorization'] = 'Client-ID YOUR_KEY_HERE'  -- Add your client id
        }
    }
}

To set up Imgur uploading:

  1. Create an Imgur account and register an application to get a Client ID.

  2. Replace 'YOUR_KEY_HERE' with your Imgur Client ID.

Example:

['imgur'] = {
    link = 'https://api.imgur.com/3/upload',
    field = 'image',
    path = 'data.link',
    options = {
        headers = {
            ['Authorization'] = 'Client-ID a1b2c3d4e5f6g7h'
        }
    }
}

FiveManage Upload

['fivemanage'] = {
    link = 'https://api.fivemanage.com/api/image',
    field = 'image',
    path = 'url',
    options = {
        encoding = 'png',
        headers = {
            ['Authorization'] = 'YOUR_KEY_HERE'
        }
    }
}

To set up FiveManage uploading:

  1. Obtain an API key from FiveManage.

  2. Replace 'YOUR_KEY_HERE' with your FiveManage API key.

  3. Optionally, change the encoding if needed.

Example:

['fivemanage'] = {
    link = 'https://api.fivemanage.com/api/image',
    field = 'image',
    path = 'url',
    options = {
        encoding = 'webp',
        headers = {
            ['Authorization'] = 'fm_api_key_123456789abcdef'
        }
    }
}

Custom Upload

['custom'] = {
    link = 'https://api.your_website.com/api',  -- Your API link
    field = 'file',
    path = 'link',
    options = {
        headers = {
            ['Authorization'] = 'Key YOUR_KEY_HERE'
        }
    }
}

To set up a custom upload solution:

  1. Replace 'https://api.your_website.com/api' with your custom API endpoint.

  2. Adjust the field and path values to match your API's requirements.

  3. Add any necessary headers, including authorization if required.

Example:

['custom'] = {
    link = 'https://imageupload.myserver.com/upload',
    field = 'image_data',
    path = 'response.image_url',
    options = {
        headers = {
            ['Authorization'] = 'Key myserver_secret_key_123',
            ['Content-Type'] = 'application/json'
        }
    }
}

Remember to choose your preferred upload method by setting Upload.Method to the corresponding key ('discord', 'imgur', 'fivemanage', or 'custom') and properly configure that method's settings.

PreviousLocalizationNextLogs

Last updated 10 months ago

Was this helpful?

📚