imagecolorclosestalpha example

// Allow opacity to be applied to the text         imagealphablending($src, true);

        $color = $isShadow ? $options['shadowColor'] : $options['color'];

        // shorthand hex, #f00         if (strlen($color) === 3) {
            $color = implode('', array_map('str_repeat', str_split($color)[2, 2, 2]));
        }

        $color = str_split(substr($color, 0, 6), 2);
        $color = imagecolorclosestalpha($srchexdec($color[0])hexdec($color[1])hexdec($color[2])$opacity);

        $xAxis = $isShadow ? $options['xShadow'] : $options['xAxis'];
        $yAxis = $isShadow ? $options['yShadow'] : $options['yAxis'];

        // Add the shadow to the source image         if (empty($options['fontPath'])) {
            // We have to add fontheight because imagettftext locates the bottom left corner, not top-left corner.             imagettftext($src$options['fontSize'], 0, (int) $xAxis(int) ($yAxis + $options['fontheight'])$color$options['fontPath']$text);
        } else {
            imagestring($src(int) $options['fontSize'](int) $xAxis(int) $yAxis$text$color);
        }

        
Home | Imprint | This part of the site doesn't use cookies.