Embed text into image script
Many are the times that we need to display an image with text that needs to be updated. That for I have developed a small script that will do this for us.
The main idea is of course to insert the text we need into an image into the position we wish – the font size and color we like.
How are we going to do that?
We will use the script image.php as an image with GET variables as input.
We can call it like:
And Voila here is the image!
//The REQUEST options for its use are
text The text you wish to embed into the image
size The font size in pts - default 24
color The color in web format like #000 or #000111
image The image path relative to the script position
x The x axis for the text default 50
y The y axis for the text default 50
save saves the image in cache folder / useful when save_file* is false
//Switches
*save_file //if this is set to true the file generated will be auto saved each time into cache dir. If you would like to tamper with the image before you get into a conclusion leave this to false.
create_dir // Create the cache dir if it doesn’t exist / some setups might not have the create rights for this command to work
Additionally you could use the script as a form of dynamically generated image via POST vars. Or everything else you might think of!
Original idea http://terriswallow.com/weblog/2007/writing-text-to-images-with-php/
- Embed_text_into_image.zip (8429 Downloads)