Hi, thanks for your reply.
Got the errors sorted, but now, I don't see my normal signature, instead just a grey gradient which is halfway down the image, where I guess it should be... *baffled*
<?php
include_once('/home/site/functions-connectonly.php');
putenv('GDFONTPATH=' . realpath('.'));
if (isset($_GET['staffid'])) {
$staffid = ($_GET['staffid']);
$num_users=mysql_num_rows(mysql_query("Select * from user where account='".mysql_real_escape_string(htmlentities($staffid))."'"));
if ($num_users>0) {
$ourGroups='';
// fetch user from db
$user=mysql_fetch_array(mysql_query("Select * from user where account='".mysql_real_escape_string(htmlentities($staffid))."'"));
$flag=mysql_fetch_array(mysql_query("Select * from flag where id_flag=".$user['location']));
// Group code here (irrelevant)
$name = "".$user['account']."";
if (strlen($ourGroups)>0) {
$text = "\n".$ourGroups."\nhttp://oursite.com";
} else {
$text = "\nNo groups\nhttp://oursite.com";
}
// tell the browser what it's about to recieve
header("Content-type: image/png");
// import background image
$img = @imagecreatefrompng("/home/site/img/sigbg.png");
// Create new blank image with sizes. Normal size is 58, add 30
$newImage = imagecreatetruecolor(185, 88);
for ($x = 0; $x < 185; $x++) {
for ($y = 0; $y < 88; $y++)
{
imagecopy($newImage, $img, $x, 185 - $y - 1, $x, $y, 1, 1);
}
}
$background = imagecreatetruecolor(185, 88);
$gradientColor = "255 255 255"; // White
$gradparts = explode(" ",$gradientColor); // get the parts of the colour (RRR,GGG,BBB)
$dividerHeight = 1;
// font details
$font = 'segoe.ttf';
// insert the flag
$insert = imagecreatefrompng("/home/site/img/flags/".$flag['img']."");
// Select the first pixel of the overlay image (at 0,0) and use
// it's color to define the transparent color
imagecolortransparent($insert,imagecolorat($insert,0,0));
// Get overlay image width and hight for later use
$insert_x = imagesx($insert);
$insert_y = imagesy($insert);
// Combine the images into a single output image. Some people
// prefer to use the imagecopy() function, but more often than
// not, it sometimes does not work. (could be a bug)
imagecopymerge($background,$newImage,0,0,0,0,185,88,100);
imagecopymerge($img,$insert,162,5,0,0,$insert_x,$insert_y,100);
// text color
$gradient_y_startpoint = $dividerHeight;
$gdGradientColor=ImageColorAllocate($background,$gradparts[0],$gradparts[1],$gradparts[2]);
$white = imagecolorallocate($img, 255, 255, 255);
$grey = imagecolorallocate($img, 225, 225, 225);
// create from a the image so we can use fade out.
$gradient_line = imagecreatetruecolor(185, 1);
// Next we draw a GD line into our gradient_line
imageline ($gradient_line, 0, 0, 185, 0, $gdGradientColor);
// add the text to the image ,
$textarr = explode("\n",$text);
$i = 16;
foreach($textarr as $a){
imagettftext($img, 10, 0, 52, 16, $white, $font, $name);
imagettftext($img, 8, 0, 52, $i, $grey, $font, $a);
$i=$i+17;
}
$ii = 0;
$transparency = 30; //from 0 - 100
while ($ii < 88) //create line by line changing as we go
{
imagecopymerge ($background, $gradient_line, 0,$gradient_y_startpoint, 0, 0, 185, 1, $transparency);
++$ii;
++$gradient_y_startpoint;
if ($transparency == 100) {
$transparency = 100;
} else {
// this will determing the height of the
// reflection. The higher the number, the smaller the reflection.
// 1 being the lowest(highest reflection)
$transparency = $transparency + 1;
}
}
// Set the thickness of the line we're about to draw
imagesetthickness ($background, 88);
// Draw the line
imageline ($background, 0, 0, 185, 0, $gdGradientColor);
// date in the past, so that the image is not cached by the browser
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// create the png image
imagepng($background);
// clean up
imagedestroy($background);
imagedestroy(gradient_line);
imagedestroy(newImage);
}
}
?>