elFinder\elFinderVolumeDriver::gdImageBackground PHP Method

gdImageBackground() protected method

Assign the proper background to a gd image
protected gdImageBackground ( resource $image, string $bgcolor )
$image resource gd image resource
$bgcolor string background color in #rrggbb format
    protected function gdImageBackground($image, $bgcolor)
    {
        if ($bgcolor == 'transparent') {
            imagesavealpha($image, true);
            $bgcolor1 = imagecolorallocatealpha($image, 255, 255, 255, 127);
        } else {
            list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
            $bgcolor1 = imagecolorallocate($image, $r, $g, $b);
        }
        imagefill($image, 0, 0, $bgcolor1);
    }