filburt1
11-13-2002, 10:00 PM
Author: filburt1
Description: Given a plethora of parameters, generates a PNG image with shadowed text in it.
Demo: http://www.turtletips.com/testing/createshadowedtext.php?bgfile=catprebg.png&color=ffffff&shadowcolor=204E6B&fontname=trebbold.ttf&fontsize=13&&textoffsetpxx=7&textoffsetpxy=5&shadowoffsetpxx=0&shadowoffsetpxy=2&s=Some%20Category%20Name&skipshadow=0 (I told you, plethora of parameters ;))
Screenshot: http://www.vbulletintemplates.com/mods/attachment.php?s=&postid=15585 . This image was generated by the demo URL above.
You need PHP with the GD library for this to work. I think this is standard for Unix and OS X, but it isn't for Windows.
If you look at my forums (see sig) there's a universal virtual light coming from 90? (i.e., exact center-top of the screen). Therefore all text and images have shadows accordingly for consistancy.
You can make shadowed text via CSS/HTML, but it will look horrible. The first method, just making two layers, produces just too plain a look. The second, a Microsoft DirectX filter, only works in IE5.5+ and looks absolutely horrible in Windows XP with ClearType.
So, the attached script generates PNG images with shadowed, antialiased text. It's reasonably well commented too if you want to modify it.
Look at the sample URL for how to state parameters. The available parameters are:
// $bgfile as the background
// $color as the font color
// $shadowcolor as the color of the shadow in HTML hex color format (no leading #)
// $fontname as the TTF filename
// $fontsize as the font's size (note: shouldn't exceed 100px-y!)
// $s as the actual string to display
// $skipshadow (optional) as a flag to disable the shadow
English:
bgfile: a .png (must be .png, no .gif, .jpg, etc!) image to use as the background
color: a hex code for the font color without a leading # (000000 is black, FF0000 is red, FFFFFF is white, etc.)
shadowcolor: same as color but used for the shadow color instead
fontname: the filename of a .ttf (true type font) file to use. Your fonts are in C:\Windows\Fonts, just upload the one you want
fontsize: the size of the font to use (not sure if PHP's GD library uses points or pixels for this)
s: the text to actually write
skipshadow: skips rendering the shadow and just draws only the text
There are no template modifications with this release; rather it is a starting point for making all sorts of crazy modifications. Whenever you want to generate an image and display it in a template, just do:
<img src="createshadowedimage.php?parameters...">
Just remember that like any URL you have to escape strings; i.e., "Some Category" would have to be "Some%20Category" because spaces aren't allowed in URLs.
And finally, this is clearly not a release for the weak. Questions will be answered but I have to assume that you have at least some knowledge of what the hell I'm rambling about. :)
Description: Given a plethora of parameters, generates a PNG image with shadowed text in it.
Demo: http://www.turtletips.com/testing/createshadowedtext.php?bgfile=catprebg.png&color=ffffff&shadowcolor=204E6B&fontname=trebbold.ttf&fontsize=13&&textoffsetpxx=7&textoffsetpxy=5&shadowoffsetpxx=0&shadowoffsetpxy=2&s=Some%20Category%20Name&skipshadow=0 (I told you, plethora of parameters ;))
Screenshot: http://www.vbulletintemplates.com/mods/attachment.php?s=&postid=15585 . This image was generated by the demo URL above.
You need PHP with the GD library for this to work. I think this is standard for Unix and OS X, but it isn't for Windows.
If you look at my forums (see sig) there's a universal virtual light coming from 90? (i.e., exact center-top of the screen). Therefore all text and images have shadows accordingly for consistancy.
You can make shadowed text via CSS/HTML, but it will look horrible. The first method, just making two layers, produces just too plain a look. The second, a Microsoft DirectX filter, only works in IE5.5+ and looks absolutely horrible in Windows XP with ClearType.
So, the attached script generates PNG images with shadowed, antialiased text. It's reasonably well commented too if you want to modify it.
Look at the sample URL for how to state parameters. The available parameters are:
// $bgfile as the background
// $color as the font color
// $shadowcolor as the color of the shadow in HTML hex color format (no leading #)
// $fontname as the TTF filename
// $fontsize as the font's size (note: shouldn't exceed 100px-y!)
// $s as the actual string to display
// $skipshadow (optional) as a flag to disable the shadow
English:
bgfile: a .png (must be .png, no .gif, .jpg, etc!) image to use as the background
color: a hex code for the font color without a leading # (000000 is black, FF0000 is red, FFFFFF is white, etc.)
shadowcolor: same as color but used for the shadow color instead
fontname: the filename of a .ttf (true type font) file to use. Your fonts are in C:\Windows\Fonts, just upload the one you want
fontsize: the size of the font to use (not sure if PHP's GD library uses points or pixels for this)
s: the text to actually write
skipshadow: skips rendering the shadow and just draws only the text
There are no template modifications with this release; rather it is a starting point for making all sorts of crazy modifications. Whenever you want to generate an image and display it in a template, just do:
<img src="createshadowedimage.php?parameters...">
Just remember that like any URL you have to escape strings; i.e., "Some Category" would have to be "Some%20Category" because spaces aren't allowed in URLs.
And finally, this is clearly not a release for the weak. Questions will be answered but I have to assume that you have at least some knowledge of what the hell I'm rambling about. :)