Im trying to create a Sig Image with dynamic variables, when i test the gd code directly it works fine, but when i include the code with the Variable code it just gives me a broken image?
<?php
require_once("VatsimPHPgenerator.php");
include "ImageCrt.php";
$VatsimPHP=new VatsimPHP;
$pilotlist=$VatsimPHP->pilot_retrieve($_REQUEST['cid']);
for($i = 0; $i < count($pilotlist); $i++)
{
//IF($pilotlist[$i][1] == $_REQUEST[cid]){ // redundant code
$Pilot_Name = $pilotlist[$i][2];
$PilotString = substr("$Pilot_Name", 0, -5)." - Online";
$PilotString .= '<br>';
$PilotString .= 'Callsign: '.$pilotlist[$i][0].', '.$pilotlist[$i][11]." - " . $pilotlist[$i][13];
$PilotString .= '<br>';
$PilotString .= 'Alt: '.$pilotlist[$i][7].' Sqrk: '.$pilotlist[$i][17];
$Sigimage = Create_Sig($PilotString);
echo "<img src=\"$Sigimage\">";
}
if(count($pilotlist) == "0")
{
echo "<p>Pilot Offline</p>";
}
?>
ImageCrt.php:
<?php
function Create_Sig($str){
header("Content-Type: image/png");
$image = ImageCreateFromPNG("./temp.png");
$color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66);
$font = './arial.ttf';
$fontSize = "10";
$fontRotation = "0";
/* Shadow */
ImageTTFText($image, $fontSize, $fontRotation, 7, 22, $colorShadow, $font, $str);
/* Top Level */
ImageTTFText($image, $fontSize, $fontRotation, 5, 20, $color, $font, $str);
ImagePng ($image);
imagedestroy($image);
}
?>
Any help would be appreciated thanks.