PHP/Graphics Image/imagecolorexact — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
| |
Текущая версия на 07:05, 26 мая 2010
Color-retrieval functions could be combined into a custom function
<?php
function getcolor($img, $red, $green, $blue) {
$color = imagecolorexact($img, $red, $green, $blue);
if($color == -1) {
$color = imagecolorallocate($img, $red, $green, $blue);
if($color == -1) {
$color = imagecolorclosest($img, $red, $green, $blue);
}
}
return $color;
}
?>