Create image thumbnails

This function creates thumbnails from images. The function saves the new thumbnail images in a thumbnails subdirectory inside the original directory. The system prepends thumbnail filenames with tn_ (for example, tn_picture.jpg).

Important:

When you disable the WebServer role, the system disables this function.

Authorizations:
query Parameters
dir
required
string

The path to the directory where the image resides. When you pass this parameter, the function creates a thumbnail directory directly below the image directory.

NOTE:

This parameter can use an absolute directory path or a path relative to the user's home directory.

Example: dir=images
height_percentage
required
integer [ 1 .. 99 ]

The percentage by which to reduce the thumbnails' height.

Example: height_percentage=25
width_percentage
required
integer [ 1 .. 99 ]

The percentage by which to reduce the thumbnails' width.

Example: width_percentage=25

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty \
  --user=username \
  ImageManager \
  create_thumbnails \
  dir='images' \
  width_percentage='25' \
  height_percentage='25'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "create_thumbnails",
  • "module": "ImageManager",
  • "result": {
    • "data": [
      • {
        • "failed": 1,
        • "file": "/home/cptest1/public_html/images/610_290.jpg",
        • "reason": "too many pixels",
        • "thumbnail_file": "/home/cptest1/public_html/images/thumbnails/tn_610_290.jpg"
        }
      ],
    • "errors": null,
    • "messages": null,
    • "metadata": {
      • "transformed": 1
      },
    • "status": 1,
    • "warnings": null
    }
}