Poszukuję rozwiązania problemu dla przezroczystości napisu używając imagettftext.
Obecnie poskładałem skrypt w takiej formie:
Kod
$width = 200;
$height = 120;
$img = imagecreatetruecolor($width, $height);
$transparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
imagefill($img, 0, 0, $transparent);
imagesavealpha($img, TRUE);
$n = "Welcome!";
$font = "arial.ttf";
$fontsize = $width/10;
$text_color = imagecolorallocate($img, 0, 0, 0);
function textCenter($img, $text, $size, $font) {
$t = imagettfbbox($size, 0, $font, $text);
$x = (imagesx($img)/2) - (($t[4] - $t[6])/2);
$y = (imagesy($img)/2) + (($t[1] - $t[7])/2);
return array("x" => round($x), "y" => round($y));
}
$t = textCenter($img, $n, $fontsize, $font);
imagettftext($img, $fontsize, 0, $t['x'], $t['y'], $text_color, $font, $n);
header("Content-Type: image/png");
imagepng($img);
imagedestroy($img);
$height = 120;
$img = imagecreatetruecolor($width, $height);
$transparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
imagefill($img, 0, 0, $transparent);
imagesavealpha($img, TRUE);
$n = "Welcome!";
$font = "arial.ttf";
$fontsize = $width/10;
$text_color = imagecolorallocate($img, 0, 0, 0);
function textCenter($img, $text, $size, $font) {
$t = imagettfbbox($size, 0, $font, $text);
$x = (imagesx($img)/2) - (($t[4] - $t[6])/2);
$y = (imagesy($img)/2) + (($t[1] - $t[7])/2);
return array("x" => round($x), "y" => round($y));
}
$t = textCenter($img, $n, $fontsize, $font);
imagettftext($img, $fontsize, 0, $t['x'], $t['y'], $text_color, $font, $n);
header("Content-Type: image/png");
imagepng($img);
imagedestroy($img);
Wykonałem przezroczystość tła ale interesuje mnie przezroczystość tekstu 80% na wzór znaku wodnego
Nie wiem jak to rozwiązać i połączyć z obecnym skryptem.

Proszę o pomoc szanowne grono forumowiczów .