Still working on it. I have only very very recently started looking at the GD functions of PHP, so my skills are certainly lacking. However here are a few scripts I have discovered.
Resizes the image and outputs it directly to a web browser witout saving the file anywhere.
Add the following at the end of the script to save the resized image to a file on your server. The original file is not destroyed.
// The file
$filename = 'images/picture.jpg';
$percent = 0.25;
// Content type
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, null, 100);
There are a great deal of terms that I am still unfamiliar with, but the following will replace one color with another in a created image. This is not exactly what we want, but at least we are getting closer. It can be applied to an image, but I do not know how to do that yet.
I got the above code from http://www.phpdig.net/ref/rn25re393.html
$im = imagecreate(200, 200);
$red = imagecolorallocate($im, 255, 0, 0);
$offblue = imagecolorallocate($im, 90, 90, 200);
imagefill($im, 0, 0, $red);
imagefilledrectangle($im, 10, 10, 40, 40, $offblue);
// above could come from an uploaded image
// find a blue in the image
$newblue = imagecolorclosest($im, 0, 0, 255);
// change it to green
imagecolorset($im, $newblue, 0, 255, 0);