Server exports

Photos and AirDrop

Server exports that add photos to a player's gallery, read it, and offer something through AirDrop.

Media links must be https:// on a host allowed in ServerConfig.Upload.AllowedHosts. See Upload.

#AddGalleryPhoto

Adds a picture or a video to a player's Photos.

Also available as: addGalleryPhoto

lua---@param target integer|string a server id or a character identifier
---@param data { url: string, thumbnail?: string, kind?: 'photo'|'video' }
---@return integer|false id
exports['fx-phone']:AddGalleryPhoto(target, data)
luaexports['fx-phone']:AddGalleryPhoto(source, { url = 'https://example.com/speed-camera.jpg' })
  • Returns false for an unknown player, a link that is not allowed, or an unknown kind.
  • A string made only of digits is read as a server id.

#GetPhotos

Returns the newest photos and videos of a player.

Also available as: getPhotosData

lua---@param target integer|string a server id or a character identifier
---@return table[] media up to 60 rows
exports['fx-phone']:GetPhotos(target)
lualocal photos = exports['fx-phone']:GetPhotos(source)
  • Each row: { id, url, thumbnail, kind, duration, favorite, createdAt }.

#AirShare

Offers something to a player through AirDrop. They can accept or decline it on their phone.

lua---@param from integer|nil the sending player's server id, or nil for a share from the system
---@param to integer the receiving player's server id
---@param kind 'photo'|'contact'|'location'
---@param data table see the table below; `data.from` names a system sender, up to 40 characters
---@return string|false id the offer id
exports['fx-phone']:AirShare(from, to, kind, data)
luaexports['fx-phone']:AirShare(nil, source, 'location', { x = 215.3, y = -810.2, label = 'Meeting point', from = 'Dispatch' })
kind data
photo { url, thumbnail?, kind? }
contact { number, firstname, lastname?, avatar? }
location { x, y, z?, label? }, label up to 60 characters
  • Returns false when the receiver's phone is not loaded, the kind is unknown or the data is invalid.
  • Without data.from, a system share is shown as coming from "AirDrop".