• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

php add title to image

Hi,

I would like to add a title to a png image in Arial. How can I do this.

I know I have to load the image with:
 imagecreatefrompng("image/1.png");
then use:
imagettftext($im, 10, 0, 10, 20, $black, $font, $text);

But with the above code the the text is in the image, I want it the be above the image. So I need to add some room (with white background) in the top of the image to add the text. How can I do this?
0
Dennie
Asked:
Dennie
  • 2
1 Solution
 
Michael701Commented:
get the x,y size of 1.png
create a new image of size x, (y+font height)
set the background color white
copy  1.png to the new image (offset to bottom)
add the text to the top white area
save the image
0
 
DennieAuthor Commented:
how do I copy the image to the new image?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now