This section of the documentation is targeted towards programmers with PHP experience. It will help you understand how the avatarMaker backend works and how you can integrate it into an existing application.
Only publicly available methods are described here, as the others can't be used outside the class scope.
Note
The avatarMaker is in continuous development based on user's feedback and necessities. For this reason, all the methods and functions discussed here may change in future releases.
This function will generate or load the configuration file and all the preview images. The generated data will be saved into the cache folder and it will be served from the disk for all the subsequent calls.
After calling this function, it will set the appropriate headers for JSON data, send the configuration and close the connection.
No Parameters
No Return
public function outAppConfig( ) { ... }
This function loads an avatar tree into the class memory. The JSON data can be passed through a paramether or, if this is empty, the function will try to load it from php://input
.
Parameter | Type | Description | |
---|---|---|---|
$json | string |
optional |
A JSON encoded avatar tree |
true
in case of success, false
otherwise.
public function setAvatar( $json = false ) { ... }
This function will generate an avatar tree based on the given MD5 string.
Warning
For a given hash, this will generate always with the same avatar, but if the content of the assets folder is changed, the generated avatar for the same hash will change!
Parameter | Type | Description | |
---|---|---|---|
$md5 | string |
required |
A valid MD5 string |
true
in case of success, false
otherwise.
public function setAvatarMd5( $md5 ) { ... }
Generates an avatar tree based on GET data. If the supplied data is only partial it will generate an incomplete avatar tree (It can still be rendered).
No Parameters
No Return
public function setAvatarGET( ){ ... }
Parameter | Type | Description | |
---|---|---|---|
$savePath | string |
optional |
A writable path (relative or absolute) with file name and extension (ex. /test/image.png) |
Note
savePath
will be ignored if the renderer_format
key in the configuration is not set to one of the _saved
options. If it is, this parameter is required for saving the avatar.
public function renderAvatar( $savePath = false ) { ... }