# 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.

Endpoint: GET /ImageManager/create_thumbnails
Version: 11.137.9999.106
Security: BasicAuth

## Query parameters:

  - `dir` (string, required)
    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: "images"

  - `height_percentage` (integer, required)
    The percentage by which to reduce the thumbnails' height.
    Example: 25

  - `width_percentage` (integer, required)
    The percentage by which to reduce the thumbnails' width.
    Example: 25

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "create_thumbnails"

  - `module` (string)
    The name of the module called.
    Example: "ImageManager"

  - `result` (object)

  - `result.data` (array)
    An array of objects containing thumbnail file information.

  - `result.data.failed` (integer)
    Whether the function failed to create the thumbnail file.

Note:

 * The function only returns this value if it doesn't create the thumbnail.
 * 1 is the only possible value.
    Enum: 1

  - `result.data.file` (string)
    The file from which the function generated the thumbnail file. An absolute filepath.
    Example: "/home/cptest1/public_html/images/610_290.jpg"

  - `result.data.reason` (string)
    The reason that the function didn't create the thumbnail file.

Note:

 The function only returns this value if it doesn't create the thumbnail.
    Example: "too many pixels"

  - `result.data.thumbnail_file` (string)
    The thumbnail file that the function generated. An absolute filepath.
    Example: "/home/cptest1/public_html/images/thumbnails/tn_610_290.jpg"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.metadata.transformed` (integer)
    Post-processing may have transformed the data.
    Enum: 1

  - `result.status` (integer)
    - 1 - Success.
- 0 - Failed. Check the `errors` field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


