diff --git a/src/PictureGenerator.php b/src/PictureGenerator.php index 64eea3c..1785ba5 100644 --- a/src/PictureGenerator.php +++ b/src/PictureGenerator.php @@ -172,8 +172,8 @@ function ($density) use ($width1x) { private function generateSrcsetItem(ImageInterface $image, PictureConfigurationItemInterface $config, $density, $descriptorType, $width1x) { $resizeConfig = clone $config->getResizeConfig(); - $resizeConfig->setWidth($resizeConfig->getWidth() * $density); - $resizeConfig->setHeight($resizeConfig->getHeight() * $density); + $resizeConfig->setWidth(round($resizeConfig->getWidth() * $density)); + $resizeConfig->setHeight(round($resizeConfig->getHeight() * $density)); $resizedImage = $this->resizer->resize($image, $resizeConfig, $this->resizeOptions); diff --git a/tests/PictureGeneratorTest.php b/tests/PictureGeneratorTest.php index cec82c6..b31188c 100644 --- a/tests/PictureGeneratorTest.php +++ b/tests/PictureGeneratorTest.php @@ -102,7 +102,7 @@ function ( $pictureConfig = (new PictureConfiguration()) ->setSize((new PictureConfigurationItem()) - ->setDensities('1x, 1.35354x, 2x') + ->setDensities('1x, 1.35354x, 1.9999x') ->setResizeConfig((new ResizeConfiguration()) ->setWidth(99) ->setHeight(99)