2014-10-19 2 views
0
이 코드에 자신의 글꼴 (트루 타입)을 사용하려는

와 PHP는 이미지를 렌더링 :자신의 글꼴

<?php 
header("Content-type: image/png"); 
// Email adres renderen 
$email = "[email protected]"; 
$length = (strlen($email)*8); 
$im = @ImageCreate ($length, 20) 
    or die ("Kan geen nieuwe afbeelding genereren"); 
$background_color = ImageColorAllocate ($im, 53, 88, 121); // Container BG: 53,88,121 
$text_color = ImageColorAllocate ($im, 194, 212, 229); 
imagestring($im, 3,5,2,$email, $text_color); 
imagepng ($im); 
?> 

이 어떻게에서 글꼴을 변경할 수 있습니다 : 오픈 산세 볼드체? 경로는 ../fonts/opensans_semibold_macroman/OpenSans-Semibold-webfont.ttf입니다.

답변

0

imagetring 함수를 사용하지 마십시오. imagettftext를 사용하십시오.이 함수는 TTF 글꼴을 사용합니다.

$font_file = "../fonts/opensans_semibold_macroman/OpenSans-Semibold-webfont.ttf"; 
imagettftext ($im, 3, 0, 5, 2, $text_color, $font_file, $email);