Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function retrieves a branding image's URL.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Branding/image?imagefile=image&needfile=0&nomagic=0&reqext=.png&skip_logo_check=0

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Get the image URL.
$image_path = $cpanel->uapi(
    'Branding', 'image',
    array(
      'imagefile'       => 'image',
      'needfile'        => '0',
      'reqext'          => '.png',
      'skip_logo_check' => '0',
    )
);

Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Get the image URL.
my $image_path = $cpliveapi->uapi(
    'Branding', 'image',
    {
      'imagefile'       => 'image',
      'needfile'        => '0',
      'reqext'          => '.png',
      'skip_logo_check' => '0',
    }
);

Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Get the image URL. -->
[% execute('Branding', 'image', { 'imagefile' => 'image', 'needfile' => '0', 'reqext' => '.png', 'skip_logo_check' => '0', } ) %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username Branding image imagefile=image needfile=0 nomagic=0 reqext=.png skip_logo_check=0

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":{  
      "path":"/usr/local/cpanel/base/frontend/paper_lantern/branding/image.png",
      "uri":"/cPanel_magic_revision_1327526145/frontend/paper_lantern/branding/image.png"
   }
}

Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample
imagefilestring

The image name.

If you do not specify a value, the needfile parameter's value determines the function's action.

Any valid image name, without the path or the extension.image
needfileBoolean

Whether to return the /unprotected/broken.gif image () with a failure message when the requested file does not exist.

This parameter defaults to 0.

  • 1 — Return nothing.
  • 0 — Return the image and a failure message.
0
reqextstringThe image's file extension.
  • .jpg
  • .ico
  • .gif
  • .png
.png
skip_logo_checkBoolean

Whether to only return the filename.

This parameter defaults to 0.

  • 0 Return the image's URL.
  • 1 Return the image's file.
0
nomagicBooleanWhether to include the

cPanel_magic_revision_########## prefix in the uri image path.

This parameter defaults to 0.

  • 1 — Do not include the prefix.
  • 0 — Include the prefix.
0

Returns

ReturnTypeDescriptionPossible valuesExample
pathstring

The path to the image.

  • A valid absolute path and filename, if the imagefile parameter's file exists.
  • An empty value, if the file does not exist and the needfile value is 1.
  • /unprotected/broken.gif, if the file does not exist and the needfile value is 0.

Note:

If you use the Paper Lantern theme, the image exists in the /usr/local/cpanel/base/frontend/paper_lantern directory.

 Click to view...
/usr/local/cpanel/base/frontend/paper_lantern/branding/image.png
uristringThe relative path to the image.A valid path and image filename, relative to the base directory.
 Click to view...
/cPanel_magic_revision_1327526145/frontend/paper_lantern/branding/image.png