Hi,
I've created a small script which creates an image with some text on. I can change a few things on this image, but not the font of the text in it, or the font size. Now, just to clarify, I want the font to be one loaded in from a .ttf file in the directory that my php file is in; I'm using arial.ttf as a test.
Here's my code so far:
You can see the results of this hereCode:<?php // Recieve vars and up them into variables $t = $_GET['text']; // Text string $h = $_GET['height']; // Height of background $w = $_GET['width']; // Width of background $x = $_GET['x']; // X position of text $y = $_GET['y']; // Y position of text // Create an image at the size defined in the vars $im = @imagecreate($w, $h); // Set background colour to green $bc = imagecolorallocate($im, 0, 255, 0); // Set text colour to red $tc = imagecolorallocate($im, 255, 0, 0); // Write the text string into an image // (resource image, font, x, y, string, text colour) imagestring($im, 5, $x, $y, $t, $tc); // Output Image header("Content-type: image/png"); imagepng($im); imagedestroy($im); ?>
Thanks for any help.![]()




Reply With Quote