1
내 captcha에 대해 다음 코드가 있습니다. 이미지의 행은 생성되지만 4 자리 숫자는 표시되지 않습니다. 거기에 몇 가지 문제가 있다고 가정합니다.imagettftext 함수가 PHP에서 작동하지 않습니다
imagettftext ($ image, $ font_size, 0,15,30, $ text_color, 'font.TTF', $ text);
코드 기능. $ _server [ 'DOCUMENT_ROOT'];를 사용하여 글꼴 파일 경로를 설정하려고했습니다. 아직 작동하지 않았다.
여기에 코드입니다 : 코드 아래
<?php
session_start();
header('Content-type: image/jpeg');
$text= $_SESSION['secure'];
$font_size =30;
$image_width= 110;
$image_height=40;
$image=imagecreate($image_width,$image_height);
imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 0, 0, 0);
for($x=1; $x<=30; $x++){
$x1 = rand(1,100);
$x2 = rand(1,100);
$y1 = rand(1,100);
$y2 = rand(1,100);
imageline($image, $x1, $x2, $y1, $y2, $text_color);
}
imagettftext($image,$font_size,0,15,30,$text_color,'font.TTF',$text);
imagejpeg($image);
?>
미안 해요, 난 당신이 실제로 말을 하려는지 이해하지 못했다 출력 -
? – user1460822
이 URL 참조 http://stackoverflow.com/questions/8496809/why-isnt-the-php-imagettftext-function-working-in-this-case –
url을 모두 참조하십시오 http://stackoverflow.com/questions/ 7034698/imagettftext-not-working –