> For the complete documentation index, see [llms.txt](https://cylexdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cylexdev.gitbook.io/docs/cylex-phone/exports-and-events/server-exports/gallery.md).

# Gallery

#### getPhotosData  <a href="#user-content-getphotosdata-server-side" id="user-content-getphotosdata-server-side"></a>

```lua
-- src: number - target player server id (source)
-- value: any - mostly unused, kept for structural consistency
-- return: table - Returns a list of all photos for the player

-- Retrieves all gallery photos belonging to the specified player.

local photos = exports['cylex_phone']:getPhotosData(src)
print("Player has " .. #photos .. " photos.")
```

#### getAlbumsData  <a href="#user-content-getalbumsdata-server-side" id="user-content-getalbumsdata-server-side"></a>

```lua
-- src: number - target player server id (source)
-- value: any - mostly unused, kept for structural consistency
-- return: table - Returns a list of all photo albums for the player

-- Retrieves all gallery albums belonging to the specified player.

local albums = exports['cylex_phone']:getAlbumsData(src)
```

#### addGalleryPhoto <a href="#user-content-addgalleryphoto-server-side" id="user-content-addgalleryphoto-server-side"></a>

```lua
-- src: number - target player server id (source)
-- value: table - photo data
-- return: none

-- Adds a new photo/video directly to the player's gallery and notifies them.

local photoData = {
    url = "https://example.com/image.png",
    thumbnail = "", -- Optional thumbnail for videos
    duration = 0,   -- For videos (in seconds), 0 for images
    time = os.time() -- Added timestamp
}

exports['cylex_phone']:addGalleryPhoto(src, photoData)
```
