🖼️ Gallery Events
yseries:server:gallery:on-photo-deleted
Triggered on the server when a gallery photo or video row is removed from the phone library.
Use this hook to delete the underlying media file from your upload provider (Fivemanage, Fivemerr, S3, custom storage, etc.) after a player deletes media from the Gallery app.
This event is emitted with TriggerEvent and is not forwarded to clients. Listen with AddEventHandler in a server script in your own resource.
When it fires:
- A player deletes a photo or video (moved to Recently Deleted / recycle bin)
- A player deletes an album and chooses to delete the photos inside it
- The server permanently purges recycle-bin rows older than 30 days
Event Data:
lua-- data: { -- id = number, -- Gallery row ID in `yphone_gallery` -- phoneImei = string, -- Phone IMEI that owned the media row -- image = string, -- Photo URL, or video file URL (`yphone_gallery.image`) -- thumbnail = string|nil, -- Video poster/thumbnail URL; `nil` for photo rows -- source = string|nil, -- Gallery source tag (`camera`, `download`, `hidden`, `private`, `other`, etc.) -- permanent = boolean, -- `false` = soft delete (recycle bin); `true` = DB row purged -- playerSource = number|nil -- Server id of the deleting player; `nil` for automated purge -- } -- playerIdentifier: string|nil -- Framework identifier of the deleting player; `nil` when purged by the server
Usage Example:
luaAddEventHandler('yseries:server:gallery:on-photo-deleted', function(data, playerIdentifier) print('Gallery media removed:', data.id, data.image) -- Recommended: only delete remote storage after permanent removal if not data.permanent then return end -- Example: delete primary media from your storage provider -- deleteRemoteMedia(data.image) -- Videos may also have a separate poster/thumbnail URL -- if data.thumbnail and data.thumbnail ~= '' then -- deleteRemoteMedia(data.thumbnail) -- end end)
Notes:
- Prefer
AddEventHandleroverRegisterNetEvent. This event is server-only and should not be triggered from the client. - When
permanentisfalse, the row still exists in the database (recycle bin) and can be restored by the player. Deleting remote storage immediately may break restore. - When
permanentistrue, the database row has been permanently removed (recycle-bin purge). - For videos,
imageis the video file URL andthumbnailis the poster frame URL. Delete both if your provider stores them separately. - Upload configuration (Fivemanage, Fivemerr, custom API) is documented in Camera / Upload.