Results 1 to 3 of 3

Thread: Source Code, Easy Implementation - No Ad's

  1. #1
    As I promised.

    Many versions of this are floating out there. This is a different one. Use as you like.

    Your host has to support php.
    ____________________________________________________________
    Version 1:

    You need three files for this.

    .htaccess
    Code:
    <Files ipdisplay.jpg>
    ForceType application/x-httpd-php
    </Files>
    ipdisplay.jpg
    Code:
    <?php
    Header ('Content-type: image/jpeg');
    Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
    Header('Pragma: no-cache');
    
    // Dimensions
    $img_width = 280;
    $img_height = 50;
    
    // Image Creation
    $image = imagecreate($img_width, $img_height);
    
    // set the colours
    $cool  = imagecolorallocate($image, 81, 86, 96);
    $black = imagecolorallocate($image, 0, 0, 0);
    $white = imagecolorallocate($image, 255, 255, 255);
    $red   = imagecolorallocate($image, 255, 0, 0);
    $grey  = imagecolorallocate($image, 204, 204, 204);
    $green = imagecolorallocate($image, 206, 129, 18);
    $blue  = imagecolorallocate($image, 0, 0, 255);
    
    // set the background colour and border
    imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);
    
    // set the font and print text
    $font = '/ttf/font/path';
    
    ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);
    
    // Display & Destroy
    imagejpeg($image);
    imagedestroy($image);
    
    ?>
    and Your Font File.
    You can play around with it to have your own custom background etc.
    _______________________________________________________________

    Version 2:

    Using your own custom image:

    Use font file as needed.

    .htaccess
    Code:
    <Files ipdisplay.png>
    ForceType application/x-httpd-php
    </Files>

    ipdisplay.png
    Code:
    <?php
    
    Header ('Content-type: image/png');
    Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
    Header('Pragma: no-cache');
    
    // Image Creation
    $image = imagecreatefrompng("image-name.png");
    
    // set the colours
    $cool = imagecolorallocate($image, 87, 87, 87);
    $black = imagecolorallocate($image, 0, 0, 0);
    $white = imagecolorallocate($image, 255, 255, 255);
    $red = imagecolorallocate($image, 255, 0, 0);
    $grey = imagecolorallocate($image, 204, 204, 204);
    $green = imagecolorallocate($image, 206, 129, 18);
    $blue = imagecolorallocate($image, 0, 0, 255);
    
    // Font Path
    $font = '/ttf/font/path';
    
    ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);
    
    // Display & Destroy
    imagepng($image);
    imagedestroy($image);
    
    ?>

    Also, create a php file and put this in
    Code:
    <?php phpinfo(); ?>
    Execute it on your server, scroll down to see if GD is enabled. It won't work if its not.

    You need to find a host where php is enabled.
    No ad's nothing like what you see in viper's sig . Feel free to have fun with it.

    Best wishes
    I.am

    ps: The instructions are clear enough. I am going to be out for a while working on another project. So wont be checking the thread that often. If I do drop in will definetly help you out otherwise many members must be knowing php they can help out quick questions.
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  2. Lounge   -   #2
    Forgot to add: the first version might look something like this


    That is not my host or anything. Apparantly he has implemented a similar script. For the example above i have used similar colors.
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  3. Lounge   -   #3
    Btw, if you any of you do use this, leave a note here, so I know its actually coming to use.
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •