Hello guys, I hope you can help me with this

I am trying to add a PHP-serverside image reflection, using the tutorial at http://www.talkphp.com/advanced-php-programming/1714-image-reflections-php.html

At the moment, we only want to apply it to our staff signatures, and for the reflection to be about 50% the height of the real image (which then fades into the background)...

I tried using the tutorial and putting the relevant lines in, changing jpeg to png (as that's what the rest uses) and only using the header, imagepng and imagedestroy lines once, but I just got tonnes of errors. Can you help me integrating that script into mine to make it work?

Thanks!

<?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");
$im = imagecreatetruecolor(185, 58);

// 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($img,$insert,162,5,0,0,$insert_x,$insert_y,100);

// text color
$white = imagecolorallocate($img, 255, 255, 255);
$grey = imagecolorallocate($img, 225, 225, 225);

// 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;
}

// 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($img);

// clean up
imagedestroy($img);

  }
}
 ?>
    Write a Reply...