![]() |
Dynamicly place text on a background image
Hey guys!
Sort of an interesting topic-title, wouldn't you say? Well then, let me explain. We've got a huge upcoming lanparty and I wanted to make a signature for the clan. That's all good an fun, until I hit this little snag. The fact of the matter is, I wanted to insert something like this. 1. A GET variable, like ?text=Still_{days}_to_go 2. Converted and replaced to "Still 8 days to go". 3. Create background image from a remote location 4. Create the string 5. Merge the images and position it on the pixels using the GET variable again. Well, I can't even get past the problem with making a sort of cool string on a transparent background. So, PNG. The background image is JPEG and I want a PNG string to be outputted onto that image. This is what I had so far. PHP Code:
/edit The working project. http://www.markernst.eu/countdown.php |
I would instead of imagestring use
PHP Code:
You can just put it directly onto the image without having to make a new image for each letter. image An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(). size The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2) angle The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text. x The coordinates given by x and y will define the basepoint of the first character (roughly the lower-left corner of the character). This is different from the imagestring(), where x and y define the upper-left corner of the first character. For example, "top left" is 0, 0. y The y-ordinate. This sets the position of the fonts baseline, not the very bottom of the character. color The color index. Using the negative of a color index has the effect of turning off antialiasing. See imagecolorallocate() fontfile The path to the TrueType font you wish to use. Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path. text |
Thanks Dale, I made it work!
|
| All times are GMT. The time now is 06:35 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0