Description

This function rebuilds the cPanel interface's sprites.

 Sprites store the cPanel interface's icons as a single image to conserve bandwidth.

When you upload an icon, the system generates sprites automatically. You may need to generate sprites manually if your changes do not display correctly.

 

Examples


https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Branding&cpanel_jsonapi_func=gensprites&method="snap_to_smallest_width"&subtype="img"&format="jpg"

$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Generate sprite files.
$generate_sprites = $cpanel->api2(
    'Branding', 'gensprites',
        array(       
            'method'      => 'snap_to_smallest_width',
            'subtype'     => 'img',
            'format'      => 'jpg',
    )
 );

 

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Generate sprite files.
my $generate_sprites = $cpliveapi->api2(
    'Branding', 'gensprites',
    {
            'method'      => 'snap_to_smallest_width',
            'subtype'     => 'img',
            'format'      => 'jpg',
    }
 );

 

cpapi2 --user=username Branding gensprites method=snap_to_smallest_width subtype=img format=jpg

{
  "cpanelresult": {
    "apiversion": 2,
    "func": "gensprites",
    "data": [
      {
        "count": ""
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Branding"
  }
}

 

Parameters

InputTypeDescriptionPossible valuesExample
methodstring

Required

The method to use to generate sprites.

  • only_filetype_gif — Generate sprites for .gif images only.
  • skip_filetype_gif — Generate sprites for all images except for .gif images.
  • snap_to_smallest_width — Scale icons to the smallest possible width.
  • scale_60percent — Scale icons to 60% of their size.

only_filetype_gif

subtypestring

The sprite type to generate.

This parameter defaults to img.

  • img
  • bg
  • compleximg
img
formatstring

The image format.

This parameter defaults to jpg.

A valid image type.jpg
compressioninteger

The level of compression to use.

This parameter defaults to 100.

An integer value that represents the amount of compression to use.100
imgtypestringThe image type.

If you use this parameter, you must supply a value of icon.

The x3 theme does not support group images.

icon

 

Returns

ReturnTypeDescriptionPossible valuesExample
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1