You might have been making PHP images before, but each time you want to one you have to look up a source.
Well I'm here to change that. I'm going to try to make this tutorial as HQ, understandable, step-by-step and organized as possible.
Let's get started.
1. The first tings you need (Required)
To make the browser understand that it is an image you're sending, and not HTML, you have to modify the headers being sent to the browser.
That can easily be done by doing this:
PHP:
header("Content-type: image/png");
Now for the actual image.
You have two options. You can either make an image with a flat color as background, or you can load an already existing image.
I will show you both methods.
Create blank image
PHP:
$img = imagecreatetruecolor($width, $height);
Create an image from an already existing file
PHP:
$img = imagecreatefrompng($filename);
2. Adding elements to the image (Optional) Specifying a color