Thursday, 15 March 2012

Render php image with own font -



Render php image with own font -

i want utilize own font (true type) in code:

<?php header("content-type: image/png"); // email adres renderen $email = "mail@mail.nl"; $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); ?>

how can alter font in: open sans semibold? path ../fonts/opensans_semibold_macroman/opensans-semibold-webfont.ttf.

do not utilize imagestring function utilize imagettftext, function allow utilize ttf fonts.

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

php image fonts rendering true-type-fonts

No comments:

Post a Comment