API Reference - Image Settings

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108119

← Back to API Reference | Getting Started

Image Settings

Image Settings define the dimension constraints and aspect ratio rules for each image slot on your directory site (EG profile photos, cover images, post thumbnails). Each record specifies a named image type, its required dimensions, minimum dimensions, and the target aspect ratio. These settings are used by the platform's image processing pipeline when members upload photos.

Model name in URL: image_settings — DB table: image_settings

The Image Setting Object

FieldTypeDescription
setting_idintegerUnique image setting ID (primary key, read-only)
setting_nicknamestringHuman-readable label for this image slot displayed in the admin panel (EG Profile Photo); max 255 characters required on create
setting_namestringMachine-readable key identifying this image slot (EG profile_photo, cover_image); max 255 characters required on create
setting_categorystringCategory grouping for this image slot (EG profile_photo, post_image); max 255 characters
setting_scopestringScope controlling which user level this setting applies to (EG parent, child); max 255 characters
setting_descriptiontextAdmin-facing description explaining this image slot's purpose, recommended dimensions, and usage
ratiostringTarget aspect ratio for cropping or enforcing proportions (EG 1:1, 3:4, 16:9); max 50 characters
widthintegerTarget width in pixels that uploaded images will be resized to
heightintegerTarget height in pixels that uploaded images will be resized to
min_heightintegerMinimum required height in pixels; uploads smaller than this will be rejected
min_widthintegerMinimum required width in pixels; uploads smaller than this will be rejected

List Image Settings

GET /api/v2/image_settings/get

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/image_settings/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "setting_id": "1",
      "setting_nickname": "Profile Photo",
      "setting_name": "profile_photo",
      "setting_category": "profile_photo",
      "setting_scope": "parent",
      "setting_description": "The maximum dimensions and ratio that your profile photos used on the website will have. The recommended default settings are a ratio of 1:1, a width of 400, and a height of 400.",
      "ratio": "1:1",
      "width": "400",
      "height": "400",
      "min_height": "200",
      "min_width": "200"
    }
  ],
  "total": "10",
  "current_page": 1,
  "total_pages": 1
}

Retrieve an Image Setting

GET /api/v2/image_settings/get/{setting_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/image_settings/get/1" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "setting_id": "1",
      "setting_nickname": "Profile Photo",
      "setting_name": "profile_photo",
      "setting_category": "profile_photo",
      "setting_scope": "parent",
      "setting_description": "The maximum dimensions and ratio that your profile photos used on the website will have. The recommended default settings are a ratio of 1:1, a width of 400, and a height of 400.",
      "ratio": "1:1",
      "width": "400",
      "height": "400",
      "min_height": "200",
      "min_width": "200"
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Create an Image Setting

POST /api/v2/image_settings/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/image_settings/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "setting_nickname=Banner+Image" \
  -d "setting_name=banner_image" \
  -d "setting_category=banner" \
  -d "setting_scope=parent" \
  -d "ratio=16:9" \
  -d "width=1200" \
  -d "height=675" \
  -d "min_height=200" \
  -d "min_width=355"

Example Response

Copy
{
  "status": "success",
  "message": {
    "setting_id": "11",
    "setting_nickname": "Banner Image",
    "setting_name": "banner_image",
    "setting_category": "banner",
    "setting_scope": "parent",
    "setting_description": null,
    "ratio": "16:9",
    "width": "1200",
    "height": "675",
    "min_height": "200",
    "min_width": "355"
  }
}

Update an Image Setting

PUT /api/v2/image_settings/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/image_settings/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "setting_id=11" \
  -d "width=1600" \
  -d "height=900" \
  -d "min_width=400" \
  -d "min_height=225"

Example Response

Copy
{
  "status": "success",
  "message": {
    "setting_id": "11",
    "setting_nickname": "Banner Image",
    "setting_name": "banner_image",
    "setting_category": "banner",
    "setting_scope": "parent",
    "setting_description": "",
    "ratio": "16:9",
    "width": "1600",
    "height": "900",
    "min_height": "225",
    "min_width": "400"
  }
}

Delete an Image Setting

DELETE /api/v2/image_settings/delete

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/image_settings/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "setting_id=11"

Example Response

Copy
{
  "status": "success",
  "message": "image_settings record was deleted"
}