如何在GDLibrary TextImage中添加字体大小和字体颜色

时间:2019-04-13 04:09:53

标签: php

您好如何在此代码中添加字体大小和字体颜色?

if (!empty($_POST['txt_input'])) {
$input_text = $_POST['txt_input'];
$width = 1180;
$height = 1180;
$textImage = imagecreate($width, $height);
$color = imagecolorallocate($textImage, 255, 255, 255);
imagecolortransparent($textImage, $color);
imagestring($textImage, 5, 10, 5, $input_text, 0xFFFFFF);
imagettftext($im, 36, 0, 10, 20, $textColor, $font, $string);
    // create background image layer
    $background = imagecreatefromjpeg('ramadan.jpg');
 // Merge background image and text image layers
    imagecopymerge($background, $textImage, 255, 200, 10, 10, $width, $height, 100);
    $output = imagecreatetruecolor($width, $height);
    imagecopy($output, $background, 0, 0, 20, 13, $width, $height)
    ob_start();
    imagepng($output);
    printf('<img id="output" src="data:image/png;base64,%s" />', base64_encode(ob_get_clean()));

请帮助 并告诉我如何在此代码中添加fontsize和字体颜色?

0 个答案:

没有答案