Child pages
  • cPanel API 1 Functions - ImageManager::convert

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function converts an image to a new file format.

 The function uses ImageMagick's convert function and is subject to the same file type limitations.

When you call this function, the system creates a new file with the same filename and specified file extension. If the function does not recognize the output format, the function copies and renames the file and does not generate a failure message.

Include Page
LIB:_cPanelAPI1NoEquivalent
LIB:_cPanelAPI1NoEquivalent

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledWebServerRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$image_convert = $cpanel->api1('ImageManager','convert',array('public_html/images','jpg')); // Call the function.

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $image_convert = $cpliveapi->api1('ImageManager','convert',['public_html/images','jpg'] ); # Call the function.

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

 


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelTagsWarning
LIB:_cPanelTagsWarning

Code Block
languagetext
<cpanel Module="ImageManager::convert($FORM('target','newtype'))">



Expand
titleCommand Line


Code Block
languagebash
cpapi1 --user=username ImageManager convert public_html/images jpg

Include Page
LIB:_cPanelAPI1CLINote
LIB:_cPanelAPI1CLINote


Expand
titleOutput (plaintext)


Code Block
Converting /home/user/test1.jpg to /home/user/test1. gif...........Done




Parameters

ParameterTypeDescriptionPossible ValuesExample
targetstring

Required

The image or directory with images to convert.

A valid directory or file path, relative to the cPanel account's home directory.public_html/images
newtypestring

Required

The format to which to convert the images.

A valid image format (for example, jpg or gif).jpg

Returns

This function returns a confirmation message.