material-palette-php
material-palette-php copied to clipboard
Palette::findMaxPopulation() returns null for no swatches
Hi,
this patch fixes fatal error in PHP 8.0
ValueError: max(): Argument #1 ($value) must contain at least one element in /www/doc/myapp/vendor/marijnvdwerf/material-palette/src/Palette.php:81
Thanks for your PR! You inspired me to actually get some CI running for this project. Do you have a sample image that causes this bug?
Try this one: https://i.pupiq.net/i/77/77/68a/3268a/2000x3000/DridzM_800x1200_d4a21c9d710fdb41.jpg
My test case is:
$manager = new Intervention\Image\ImageManager(["driver" => "imagick"]);
$img = $manager->make("image.jpg");
$palette = marijnvdwerf\palette\Palette::generate($img);
Hi @marijnvdwerf, here is another one: https://i.academiabooks.com/i/78/78/8fa/408fa/1080x1080/tJjc5g_800x800_5ce785a23177ec05.png