diff --git a/src/Layout/PictureBox.php b/src/Layout/PictureBox.php index 12228f6..3fc01d7 100644 --- a/src/Layout/PictureBox.php +++ b/src/Layout/PictureBox.php @@ -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 diff --git a/tests/Integration/ImageTest.php b/tests/Integration/ImageTest.php index d5dd1bd..407e9e2 100644 --- a/tests/Integration/ImageTest.php +++ b/tests/Integration/ImageTest.php @@ -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', + ]; } } diff --git a/tests/Integration/__snapshots__/ImageTest__test_basic_image with data set avatar too small__1.png b/tests/Integration/__snapshots__/ImageTest__test_basic_image with data set avatar too small__1.png new file mode 100644 index 0000000..9026b78 Binary files /dev/null and b/tests/Integration/__snapshots__/ImageTest__test_basic_image with data set avatar too small__1.png differ