Simple page





Tuesday, 24 April 2012 00:00

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:

 <img src="/image.php?text=Have a nice Spring&image=test.jpg&x=350&y=320&size=35&color=aaafff" alt="" /> 

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


*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

Read 7764 timesLast modified on Monday, 12 November 2012 15:47
More in this category:Spacegallery script with Links »

Leave a comment