Skip to content

Commit ce5b2b1

Browse files
authored
Merge pull request #64 from tomStory9/patch-1
Fix : Issue 63
2 parents 6d58fd7 + 38dd3f9 commit ce5b2b1

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

src/InitialAvatar.php

+32-32
Original file line numberDiff line numberDiff line change
@@ -636,44 +636,44 @@ protected function getTranslator()
636636
*
637637
* @return Image
638638
*/
639-
protected function makeAvatar($image)
640-
{
641-
$width = $this->getWidth();
642-
$height = $this->getHeight();
643-
$bgColor = $this->getBackgroundColor();
644-
$name = $this->getInitials();
645-
$fontFile = $this->findFontFile();
646-
$color = $this->getColor();
647-
$fontSize = $this->getFontSize();
648-
649-
if ($this->getRounded() && $this->getSmooth()) {
650-
$width *= 5;
651-
$height *= 5;
652-
}
639+
protected function makeAvatar($image)
640+
{
641+
$width = $this->getWidth();
642+
$height = $this->getHeight();
643+
$bgColor = $this->getBackgroundColor();
644+
$name = $this->getInitials();
645+
$fontFile = $this->findFontFile();
646+
$color = $this->getColor();
647+
$fontSize = $this->getFontSize();
653648

654-
$avatar = $image->canvas($width, $height, !$this->getRounded() ? $bgColor : null);
649+
if ($this->getRounded() && $this->getSmooth()) {
650+
$width *= 5;
651+
$height *= 5;
652+
}
655653

656-
if ($this->getRounded()) {
657-
$avatar = $avatar->circle($width - 2, $width / 2, $height / 2, function ($draw) use ($bgColor) {
658-
return $draw->background($bgColor);
659-
});
660-
}
654+
$avatar = $image->canvas($width, $height, !$this->getRounded() ? $bgColor : null);
661655

662-
if ($this->getRounded() && $this->getSmooth()) {
663-
$width /= 5;
664-
$height /= 5;
665-
$avatar->resize($width, $height);
666-
}
667-
668-
return $avatar->text($name, $width / 2, $height / 2, function (AbstractFont $font) use ($width, $color, $fontFile, $fontSize) {
669-
$font->file($fontFile);
670-
$font->size($width * $fontSize);
671-
$font->color($color);
672-
$font->align('center');
673-
$font->valign('center');
656+
if ($this->getRounded()) {
657+
$avatar = $avatar->circle($width - 2, $width / 2, $height / 2, function ($draw) use ($bgColor) {
658+
return $draw->background($bgColor);
674659
});
675660
}
676661

662+
if ($this->getRounded() && $this->getSmooth()) {
663+
$width /= 5;
664+
$height /= 5;
665+
$avatar->resize($width, $height);
666+
}
667+
668+
return $avatar->text($name, $width / 2, $height / 2, function ($draw) use ($width, $color, $fontFile, $fontSize) {
669+
$draw->file($fontFile);
670+
$draw->size($width * $fontSize);
671+
$draw->color($color);
672+
$draw->align('center');
673+
$draw->valign('center');
674+
});
675+
}
676+
677677
/**
678678
* @return SVG
679679
*/

0 commit comments

Comments
 (0)