FiveM SDK — images
All capture goes through presigned URLs: your API token never reaches a
client. Requires screenshot-basic (started before spawnbase).
Client: takeImage
Section titled “Client: takeImage”Captures the calling player’s own screen and uploads it. Client-side export; returns a promise in JS, and in Lua wrap it in a thread.
local image = exports.spawnbase:takeImage({ name = "Player Screenshot", description = "Captured via script",})
if image then print("Image uploaded to: " .. image.url)endSignature: takeImage(metadata?) → { url } | nil (nil on failure).
Server: takeServerImage
Section titled “Server: takeServerImage”Requests a screenshot from a specific player and uploads it.
local ok, image = pcall(function() return exports.spawnbase:takeServerImage(1, { reason = "Admin investigation", }, 10000) -- timeout in ms, default from config (10000)end)
if ok and image then print("Image uploaded: " .. image.url)else print("Capture failed: " .. tostring(image))endSignature: takeServerImage(playerSource, metadata?, timeout?) → { url }.
Fails on timeout, on the player disconnecting, or if the client capture
errors.
Server: uploadImage / uploadFile
Section titled “Server: uploadImage / uploadFile”Upload data you already have (base64 string or a data URI). Typically used from JS/TS server code; from Lua pass a base64 string.
local image = exports.spawnbase:uploadImage(base64Png, { fileName = "evidence.png", metadata = { name = "Evidence", playerSource = 1 },})-- image.url, or nil on failureuploadFile is the same call for any media type (image, video, audio)
and returns the full { id, url } record.
Metadata
Section titled “Metadata”Attach any JSON-serialisable table. Common fields: name, description,
playerSource (links the file to a player). Metadata is stored with the
file and searchable in the dashboard.
Capture metadata is bound when the presigned URL is minted (the API
binds filename/path/metadata into the one-time grant), so
name/description/playerSource passed to takeImage /
takeServerImage are stored with the file even though screenshot-basic
performs the upload itself.