Help with PHP and Apache for sig script wanted

Commissario
Joined
16 Oct 2002
Posts
2,860
Location
In the radio shack
Now that I've got my ADSL installed I'm running a Windows 2000 box with Apache on it.

I'd like to get php scripting working so that I can host my own signature and not have to bother others if I want to change anything.

What do I need, where do I get it from and how do I configure it all?

I'm asking here because there are obviously people who are already doing this for their (and others) scripts so there must be a wealth of knowledge.

Mr. taliesyn currently hosts mine so I guess that if nothing else, I'll need a copy of the script you're using, good sah.

K.
 
Commissario
OP
Joined
16 Oct 2002
Posts
2,860
Location
In the radio shack
I've been going through the sticky and I've got as far as getting a basic installation of PHP on which can be seen by clicking here

Doesn't seem to have the GD stuff though so I'm looking further now.

K.
 
Commissario
OP
Joined
16 Oct 2002
Posts
2,860
Location
In the radio shack
Heh - I think you've noticed that I've done that already.

It was actually php_gd2.dll but the effect seems to have been the same.

Now - Having never used php scripts before I'm a bit stuck.

K.
 
Commissario
OP
Joined
16 Oct 2002
Posts
2,860
Location
In the radio shack
Ahah, Mr. Phil. If you re-read my post here you'll see a linkie to my test.php file which is working all fine and his dandy.

What I really want is the script that Mr. taliesyn is already using for my sig - It works and it works well so I can tweak that as required.

K.
 
Commissario
OP
Joined
16 Oct 2002
Posts
2,860
Location
In the radio shack
seti.php


That's taking my sig from my own pages using the self same script that it's currently being hosted with but as you can see, it's not doing the right thing with the font size.

I've tried changing the fontsize in the switches when it's called and that makes no difference and I've tried adjusting the default font size in the php.

Hmmmmm.

K.
 
Commissario
OP
Joined
16 Oct 2002
Posts
2,860
Location
In the radio shack
No, there's nothing in the script that refers to the specific font that I can see at all. The only references to font are for the size.

Had a look at all the scripts in that thread, but the one I'm using from taliesyn is totally different allowing positioning of text, size, colours etc etc.

K.
 
Commissario
OP
Joined
16 Oct 2002
Posts
2,860
Location
In the radio shack
OK, using the following code:

Code:
<?php
//Code for overlaying SETI stats over a JPEG or PNG image
//By Phil Cutler (kaiowas) of Team OcUK Oct 2002
//Revised by Mark Gray Apr 2003
//Visit the OcUK team forum: [url]http://forums.overclockers.co.uk/fo...php?&forumid=39[/url]
//Uses a local file to cache the users total and reduce bandwidth hit on Berkeley
//Setup Variables For Sig
   $UserEmail="[email protected]";
//   $PreText="Team OcUK - Get WU's Or Die Tryin'";
//   $PostText="WU's owned";
   $TextRed=0;
   $TextGreen=0;
   $TextBlue=0; 
   $FontSize=10;
   $TextX=164;
   $TextY=-8;
   $ImageURL="http://www.all-one-word.com/setisig/feek.png";
   $UpdatePeriod=900; //Maximum frequency in seconds at which the script will poll Berkeley 
//Setup Variables For Webspace - Must be absolute paths
   $LocalFile="c:\Program Files\Apache Group\Apache2\htdocs\setisig\WUTotal.dat";
   $FontFile="c:\Program Files\Apache Group\Apache2\htdocs\setisig\times.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 . "\r\n" . $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);
   }
?>

This produces lots of errors

I have the font file in the location specified, the script has created a file called WUTotal.dat but when I view that file in notepad it contains "User not found."

Summat's not right.

K.
 
Back
Top Bottom