|
2 | 2 |
|
3 | 3 | namespace LasseRafn\InitialAvatarGenerator; |
4 | 4 |
|
5 | | -use Intervention\Image\AbstractFont; |
6 | 5 | use Intervention\Image\Image; |
7 | 6 | use Intervention\Image\ImageManager; |
8 | 7 | use LasseRafn\InitialAvatarGenerator\Translator\Base; |
@@ -636,43 +635,43 @@ protected function getTranslator() |
636 | 635 | * |
637 | 636 | * @return Image |
638 | 637 | */ |
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(); |
| 638 | + protected function makeAvatar($image) |
| 639 | + { |
| 640 | + $width = $this->getWidth(); |
| 641 | + $height = $this->getHeight(); |
| 642 | + $bgColor = $this->getBackgroundColor(); |
| 643 | + $name = $this->getInitials(); |
| 644 | + $fontFile = $this->findFontFile(); |
| 645 | + $color = $this->getColor(); |
| 646 | + $fontSize = $this->getFontSize(); |
648 | 647 |
|
649 | | - if ($this->getRounded() && $this->getSmooth()) { |
650 | | - $width *= 5; |
651 | | - $height *= 5; |
652 | | - } |
| 648 | + if ($this->getRounded() && $this->getSmooth()) { |
| 649 | + $width *= 5; |
| 650 | + $height *= 5; |
| 651 | + } |
653 | 652 |
|
654 | | - $avatar = $image->canvas($width, $height, !$this->getRounded() ? $bgColor : null); |
| 653 | + $avatar = $image->canvas($width, $height, !$this->getRounded() ? $bgColor : null); |
655 | 654 |
|
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 | | - } |
| 655 | + if ($this->getRounded()) { |
| 656 | + $avatar = $avatar->circle($width - 2, $width / 2, $height / 2, function ($draw) use ($bgColor) { |
| 657 | + return $draw->background($bgColor); |
| 658 | + }); |
| 659 | + } |
661 | 660 |
|
662 | | - if ($this->getRounded() && $this->getSmooth()) { |
663 | | - $width /= 5; |
664 | | - $height /= 5; |
665 | | - $avatar->resize($width, $height); |
666 | | - } |
| 661 | + if ($this->getRounded() && $this->getSmooth()) { |
| 662 | + $width /= 5; |
| 663 | + $height /= 5; |
| 664 | + $avatar->resize($width, $height); |
| 665 | + } |
667 | 666 |
|
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 | | -} |
| 667 | + return $avatar->text($name, $width / 2, $height / 2, function ($draw) use ($width, $color, $fontFile, $fontSize) { |
| 668 | + $draw->file($fontFile); |
| 669 | + $draw->size($width * $fontSize); |
| 670 | + $draw->color($color); |
| 671 | + $draw->align('center'); |
| 672 | + $draw->valign('center'); |
| 673 | + }); |
| 674 | + } |
676 | 675 |
|
677 | 676 | /** |
678 | 677 | * @return SVG |
|
0 commit comments