imagettftext, letter spacing, and size with php

I have made a function that takes text, adds spacing between the letters, and makes an image out of it. The following code works.

// $letterspace is the input from user
        $letterspace = $userinput;
// Store text to get individual letters in loop
        $text = self::$text;
// Set variable width to be manipulated by input
        $temp_x = $x;
// Run loop for each letter, changing width as desired by user
        for ($i = 0; $i < strlen($text); $i++)
        {
            $bbox = imagettftext(self::$image, 16, 0, $temp_x, 16, self::$color, self::$font, $text[$i]);
            $temp_x += $letterspace + ($bbox[2] - $bbox[0]);
        }
// Return image
        $tr = imagecolorallocatealpha(self::$image, 0, 0, 0, 127);
        return self::imagetrim(self::$image, $tr);

What I need to do however, is change the size so that it is larger. Let’s look at this line.

$bbox = imagettftext(self::$image, 16, 0, $temp_x, 16, self::$color, self::$font, $text[$i]);

That first 16 is the font size. When I increase it, say to 64, I only get the bottom of the image. It also seems that the text in the image is no longer letter spaced.

That second 16 is the y-ordinate, which sets the fonts baseline. When I increase it to match the font size, it increases the size, but the text in the image is no longer letter spaced. When I increase only the y-ordinate, there is no effect as I can see.

What can I do to increase the size of the image, while maintaining the text and the letter spacing.


Download imagettftext.letter.spacing.and.size.with.php.zip
Direct Link


Download


Download imagettftext.letter.spacing.and.size.with.php.zip
Mediafire


Download


Download imagettftext.letter.spacing.and.size.with.php.zip
Uppit


Download


Download imagettftext.letter.spacing.and.size.with.php.zip
FILESMONSTER


Download


Download imagettftext.letter.spacing.and.size.with.php.zip
Ge.tt


Download