Updatable sig pic

I would like to have the facility to create my own updatable sig pic with all the relevant images, etc on my own webspace.

I have had ones created using other peoples facilities, but it stores the info locally on their server & if that goes down for any reason all I get is the lovely red cross box, which really bugs me.

Any ideas/help please? :confused:

Looks like yours is hosted by Barry, he was having to move stuff around yesterday I think it was. Maybe thats why itโ€™s not working at the minute.

Well that answers that at least. Thanks Ren.

New sig maker will be up and running soon, just need to finish the database off :slight_smile:

Cheers Barry. I like playing with software to see what it will do & this seemed like an ideal bit to play with. Iโ€™ve been having a look at the PHP website (www.php.net) for tips, but it looks like Iโ€™m on a learning curve.

HTML was easy, this is a little more of a challenge though. Any tips or pointers you can suggest would be gratefully received. :thumbsup:

easyest way is to use this, need GD installed on your server to use it.

<?php



//Setup Variables For Sig
   $UserEmail="seti@emaladdie.com";
   $PreText="";
   $PostText="your text";
   $TextRed=255;
   $TextGreen=255;
   $TextBlue=255;
   $FontSize=15;
   $TextX=60;
   $TextY=40;
   $ImageURL="url to image";
   $UpdatePeriod=900; //Maximum frequency in seconds at which the script will poll Berkeley

//Setup Variables For Webspace - Must be absolute paths
   $LocalFile="patchtodata/WUTotal.dat";
   $FontFile="/pathtofont/discognate.ttf";


   if(!file_exists($LocalFile) or !FileMTime($LocalFile) or time()-FileMTime($LocalFile)>$UpdatePeriod)
   {

    //Get Total Number Of WUs from personal stats page at Berkeley
    $fp =@fopen ("http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?email=" . $UserEmail . "&cmd=user_stats_new", "r");
    if ($fp)
    {
     while (!feof($fp))
     {
      $WebPage.=fgets($fp,200);
     }
     fclose($fp);

     if (strpos($WebPage,"No user with that name was found")==0)
     {
      $TotalStart=strpos($WebPage,"Results Received");
      $StartPos=strpos($WebPage,"<td>",$TotalStart)+4;
      $EndPos=strpos($WebPage,"</td>",$StartPos);
       $WUs=ltrim(rtrim(substr($WebPage,$StartPos,$EndPos
-$StartPos)));
     }
     else
     {
      $WUs="User not found.";
     }

     //Update Local File With Total
     $Output = fopen ($LocalFile, "a");
     ftruncate ($Output, 0);
     fseek($Output,0);
     fwrite($Output, $WUs);
     fclose($Output);
    }
   }

   //Read Total from Local File
   $Local=@fopen ($LocalFile, "r");
   $WUs=fgets($Local,200);
   fclose($Local);


   //Build Text String
   $Text=$PreText . "
" . $WUs . " " . $PostText;

  //Create Image
   $size = ImageTTFBbox ($FontSize, 0, $FontFile , $Text);

   $im_x=abs($size[4]-$size[0]);
   $im_y=abs($size[5]-$size[1]);

   if (substr($ImageURL,strlen($ImageURL)-3,3)=="jpg")
   {
    //Create a Sig image based on a JPEG
    Header("Content-type: image/jpeg");
    Header("Expires: " . gmdate("D, d M Y H:i:s", time() + 900) . " GMT");
    $im_size = GetImageSize ($ImageURL);
    $imageWidth = $im_size[0];
    $imageHeight = $im_size[1];
    $im = ImageCreateFromJPEG($ImageURL);
    $text_color = imagecolorclosest ($im, $TextRed, $TextGreen, $TextBlue);
    if ($TextX+$im_x>$imageWidth){$TextX=$imageWidth-$im_x-2;}
    if ($TextY>$imageHeight){$TextY=$imageHeight-2;}
    imagettftext ($im, $FontSize, 0, $TextX, $TextY, $text_color, $FontFile, $Text);
    ImageJpeg ($im);
    ImageDestroy ($im);
   }
   elseif (substr($ImageURL,strlen($ImageURL)-3,3)=="png")
   {
    //Create a Sig image based on a PNG
    Header("Content-type: image/png");
    Header("Expires: " . gmdate("D, d M Y H:i:s", time() + 900) . " GMT");
    $im_size = GetImageSize ($ImageURL);
    $imageWidth = $im_size[0];
    $imageHeight = $im_size[1];
    $im = ImageCreateFromPNG($ImageURL);
    $text_color = imagecolorclosest ($im, $TextRed, $TextGreen, $TextBlue);
    if ($TextX+$im_x>$imageWidth){$TextX=$imageWidth-$im_x-2;}
    if ($TextY>$imageHeight){$TextY=$imageHeight-2;}
    imagettftext ($im, $FontSize, 0, $TextX, $TextY, $text_color, $FontFile, $Text);
    ImagePNG ($im);
    ImageDestroy ($im);
   }
?>