PHP code example of terminal42 / contao-avatar

1. Go to this page and download the library: Download terminal42/contao-avatar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

terminal42 / contao-avatar example snippets


// Member avatar (path only)
\Avatar::getMember(\FrontendUser::getInstance()->id);

// Member avatar 100x100px (path only)
\Avatar::getMember(\FrontendUser::getInstance()->id, 100, 100);

// Member avatar (HTML)
\Avatar::getMemberHtml(\FrontendUser::getInstance()->id);

// Member avatar 100x100px (HTML)
\Avatar::getMemberHtml(\FrontendUser::getInstance()->id, 100, 100);

// User ID 4 avatar (path only)
\Avatar::getUser(4);

// User ID 4 avatar 100x100px (path only)
\Avatar::getUser(4, 100, 100);

// User ID 4 avatar (HTML)
\Avatar::getUserHtml(4);

// User ID 4 avatar 100x100px (HTML)
\Avatar::getUserHtml(4, 100, 100);