Table of contents

Thumbnails API

Serving thumbnails

The GrayMeta Platform serves thumbnails and frames via the /api/files endpoint. See the Files API.

GET /api/files/{item_id}/{path}

The path value comes from the Thumbnail structure described below.

Thumbnail structure

The GrayMeta Platform attempts to generate a thumbnail for every item, the results of which are stored in the thumbnail structure in the Item Object.

{
    "thumbnail": {
        "type": "{type}",
        "path": "{path}",
        "width": {width},
        "height": {height},
        "frames": {
            "count": {frame-count}
        }
    }
}
  • {type} - (string) The type of the thumbnail (see Thumbnail types below)
  • {path} - (string) The path to the thumbnail which can be used to download or display the image
  • {width} - (int) The width of the thumbnail
  • {height} - (int) The height of the thumbnail
  • {frame-count} - (int) Number of frames represented in a sprite thumbnail

Thumbnail types

The GrayMeta Platform may produce one of many types of thumbnails. The dimensions of the image are thumbnail.width by thumbnail.height

Images

Most thumbnails are normal images, and they have the image type.

Sprites

Thumbnails with the sprite type indicates that the image is wide and made up of many frames. The number of frames will be present in the frames.count field.

The true width of the image will be width x frames.count. The viewport should be width by height.

Rotating Thumbnail

Rotate an image item’s thumbnail. Only valid for an item that has a gm_item_type of image.

PATCH /api/data/v3/items/{item_id}/thumbnail

{
   "rotation": ENUM["clockwise" | "counterclockwise" | "flip"]
}
  • clockwise rotates the thumbnail clockwise 90 degrees
  • counterclockwise rotates the thumbnail counterclockwise 90 degrees
  • flip rotates the image 180 degrees

This documentation is generated from the latest version of GrayMeta Platform. For documentation relevant to your own deployed version, please use the documentation inside the application.