Description

This function retrieves a branding image's URL.

Examples 


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

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

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

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

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

{  
   "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"
   }
}

   

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.

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

/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.
/cPanel_magic_revision_1327526145/frontend/paper_lantern/branding/image.png