PHP code example of maba / avatar-bundle
1. Go to this page and download the library: Download maba/avatar-bundle 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/ */
maba / avatar-bundle example snippets
new Maba\Bundle\AvatarBundle\MabaAvatarBundle(),
namespace Acme;
use Maba\Bundle\AvatarBundle\Service\AvatarProviderInterface;
class MyAvatarProvider implements AvatarProviderInterface
{
// ...
public function getAvatar($email, $size)
{
$user = $this->repository->findOneByEmail($email);
if ($user === null) {
// we don't have avatar - other providers will by called by priority
return null;
}
return $this->avatarPath . $user->getAvatar();
}
// ...
}