Skip to content

Commit

Permalink
Fix for when the picture is smaller than the circle
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhamp committed Jan 17, 2024
1 parent 847573d commit c5cd444
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Layout/PictureBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function mask(Imagick $mask): void
public function circle(): static
{
$this->maskQueue[] = function () {
$width = $this->box->width();
$width = $this->getPrerenderedBox()->width();
$start = intval(floor($width / 2));

// Create the circle
Expand Down
9 changes: 9 additions & 0 deletions tests/Integration/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,14 @@ public static function snapshotImages(): iterable
->watermark(__DIR__.'/../resources/wide-logo.png'),
'avatar-layout',
];

yield 'avatar too small' => [
(new Image())
->layout(new Avatar)
->accentColor('#003')
->picture('https://i.pravatar.cc/200?img=10')
->title('Simone Hampstead'),
'avatar-too-small',
];
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c5cd444

Please sign in to comment.