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.
Request
- Base URLhttps://cpanel-server.tld:2083/execute
- AuthHTTP basic
Query parameters
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.
The percentage by which to reduce the thumbnails' height.
The percentage by which to reduce the thumbnails' width.
Response
HTTP Request was successful.
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
}
}Changes
No recorded changes to this operation across all 5 revisions of this API.