v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
ImageManager
Image Tools

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.

get/ImageManager/create_thumbnails

Query parameters

dirstring required
Example:images

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.

height_percentageinteger required
Example:25

The percentage by which to reduce the thumbnails' height.

width_percentageinteger required
Example:25

The percentage by which to reduce the thumbnails' width.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "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"
      }
    ],
    "metadata": {
      "transformed": 1
    },
    "status": 1
  }
}