Being able to put one image on top of another is essential. In GD you can import an image and then composite another image on it or you can create your own image and composite something on it. Your composite images can be gif, jpeg or png. Note that some colors may fade and some change completely depending on the graphic. If your composite has been made in GD the colors remain true.


For this we will concentrate on using an import image for our background. We import our image just as we did when annotating. It is called the photoimage. And our composite is imported the same and is called the logo image. You'll see the positioning line of the logo image has four numbers. The first two numbers are the x and y position where you want the image to be composited. The last two numbers will give you a black shadow. (NOTE: At this time that is the only color we can get.) These two numbers are in pixels. I've used 2 and 2 and had some good results with small composites.

Here's an example: The zip file contains everything needed. For this graphic.

Script Image

For this we create an image in the script first...then we composite. Our composite is still called the logo image but there is no photo image. The same four numbers designate the postion and shadow if you choose to have it....

Here's an example of this.

Here's the text file for this graphic. Use the small heart from a prevous lesson or one of your own choosing.

Different graphics will give different results...Experiment and you'll find something that appeals to you.

The import images can be any URL from anywhere on the web. But if you will be using it as a php file, remember that you are direct linking and that page will load every time the page you have it on loads using lots of bandwidth. Therefore if it is to remain as a php page IN USE it is wise to transload, upload the graphic to your own webspace.

GD BasicsHome