I added a cool function to the header. If you notice the image at the top… It’s an image, but really its made from a php script and a ttf font. I got the original script from the WordPress Support Forums and made some code cleanup changes and improved it so you can set all the parameters along with setting the size of the box dynamically based on the size of font and length of text.
You can view the source and sample code by downloading this file.
Nice, very nice. Thanks for the contribution! Put the link (and/or the code) on the WP wiki!
Hey cool site and interesting opinions ;). I write a lot and have both an opinion/news site and just a daily blog. Feel free to check it out.
Thanks, nice site too…
Is it possible to create the images with a transparent background? Send me an e-mail if you get a chance.
Yes it is possible…
Use the imageColorTransparent($im, $txt_background); at the end of my script before the createPNG(); command.
Thought about this script again and thought I’d check back. I’d like to be able to limit the width of the image it creates, can it wrap by words somehow? That would be Ultra-Cool!!
Hmm, yeah could limit the width of the email it creates, but that will then crop the text at that width.
As for wrapping the Words, that’s a bit tougher, I believe there would be a way, but you’d have to calculate the size of the line, compare it to the size of the box and… well, over my head. There is some decent documentation on this GD PHP function at http://www.php.net.
Great piece of code. In the titles.php I changed the shadow calcs to:
$shdw_x = $shdw_x_offset + $txt_x; // Shadow Horizontal Calculation
$shdw_y = $shdw_y_offset + $txt_y; // Shadow Vertical Calculation
as it looked like the calc was being repeated. Also, have you tried doing this with ImageMagick? Wondering if I can cut down the output file size even further.
Great little trick! Is there any way to smooth out the resulting edges so as to take care of the jaggedness of the font?
Thanks!