UAPI Functions - Branding::image

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

 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',
    )
);

 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',
    }
);

 cPanel Template Toolkit

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

 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.

 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_lanter/branding/image.png"
   }
}

 

Note:

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

 

Parameters

Parameter

Type

Description

Possible values

 Example 

imagefile

string

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

needfile

Boolean

 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

reqext

string

The image's file extension.

  • .jpg
  • .ico
  • .gif
  • .png

.png

 skip_logo_check 

 Boolean 

Whether to only return the filename.

This parameter defaults to 0.

  • 0 — Return the image's URL.
  • 1 — Return the image's file.

0

nomagic

Boolean

Whether 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

 Return 

Type

Description

Possible values

path

string

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 needfilevalue is 0.

Note:

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

uri

 string 

 The relative path to the image. 

A valid path and image filename, relative to the base directory.

 

  • 11 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....