Rotating banner...

May 2, 2016
3
0
36
Hello community, I'm currently using on my ts3 server, this "banner script", who shows hours, date, name and other things. But, I need a way to put this script rotating some pictures, and not just once picture. Someone can help me? Thanks.
Config.php

PHP:
<?php

    /*
   
    @author     David
    @copyright  2016 Multivitamin <multivitamin.wtf>
    @license    GPLv3 http://www.gnu.org/licenses/gpl.html
    @version    1.2beta

    Textfields Available Placeholders
        TEAMSPEAK:
            %status% - Displays online or offline
            %sid% - Displays Server ID currently used
            %sport% - Displays Server Port
            %platform% - Displays on wich Platform the Server runs
            %servername% - Displays the Server Name (top channel name)
            %serverversion% - Displays the Server Version
            %maxclients% - Displays Slots Available
            %realclients% - Displays Clients only
            %clientsonline% - Displays amount of Clients online (Couns Queries aswell!)
            %channelcount% - Displays amount of channels
            %packetloss% - Displays average Packetloss (Like: 4.2134)
            %packetloss_00% - Displays average Packetloss (Like: 4.21)
            %packetloss_floored% - Displays average Packetloss (Like: 4)
            %ping% - Diplays Average Ping (Like:  64.2414)
            %ping_floored% - Diplays Average Ping floored (Like: 64)
            %nickname% - Displays the Nickname of the Client which is requesting the Banner
            %groupcount[<servergroupids>]% - Counts the Groups in the Square Brackets write it like '2,6' where 2 and 6 is a Server Group ID
        GENERAL
            %timeHi% - Displays Time in Hour:Minute Format
            %timeHis% - Displays Time in Hour:Minute:Second Format
            %date% - Displays Date in day.month.Year Format
        SOURCEQUERY
            %sqinfo[<server>][<key>]% - Displays the specified Info Key for the specified Server you have entered
           
       
    INFO for %nickname%:
        If you have a Textfield where you want to use the placeholder %nickname% then you are not able to use
        other Placeholders since this gets rendered individually for every client!

    What is SourceQuery?
        The SourceQuery PHP Library was written by xPAW (https://github.com/xPaw/PHP-Source-Query)
        It can access Informations of a Server which uses the Source Protocol
        You can find a List of Supported Games in the Link above!
       
    Usage of %sqinfo[<server>][<key>]%
        The First Parameter <server> defines the server you want to use, this will be explained later how to login to a Server
        The Second Parameter <key> defines the Server Information you want to access, instructions on how to get all available Keys for a Server
        is also explained later in this config file
       
    IMPORTANT!
        CURRENTLY SUPPORTED FORMAT FOR BACKGROUND IMAGE IS .PNG ONLY!
        You need to give the folger cache/ write Permissions!
        On Standard Debian Configuration you can do this while inside Banner Folder with the Command:
                chown -R www-data cache
       
    TEAMSPEAK:
        Add in Teamspeak "Banner Gfx Url" the Web Path to your banner.php
        Change the "Gfx Interval" to 60 so the Client requests a new Banner every 60 Seconds!
        PERMISSIONS:
            b_virtualserver_servergroup_list
            b_serverinstance_version_view
            b_serverinstance_info_view
            b_virtualserver_connectioninfo_view
            b_virtualserver_client_list
            b_client_remoteaddress_view - For Nickname display
                and probably some more.... I will edit this List later lol....
   
    DIFFERENT FONTS:
        Currently available Fonts inside the "font" Folder is
            - arial.ttf
            - bank.ttf
            - neuropoliticalrg.ttf
        You can download fonts for example from http://www.dafont.com
       
       
    REQUIREMENTS
        PHP Version 5.5 or greater
        Web Server with php5-gd installed (apt-get install php5-gd)
        If SourceQuery is enabled it will need php5-gmp to operate!
           
       
           
    */
   
    $config = array('textfield' => [], 'sourcequery' => []);

    /*
    ** Teamspeak Configurations
    */

    //Teamspeak Connection IP
    $config['teamspeak']['ip'] = 'serverip';
    //Teamspeak Query Port
    $config['teamspeak']['queryport'] = '10011';
    //Teamspeak Connection/Voice Port
    $config['teamspeak']['serverport'] = '9988';
    //Teamspeak Query Login Name
    $config['teamspeak']['loginname'] = 'login';
    //Teamspeak Query Password
    $config['teamspeak']['loginpass'] = 'loginpass';
   
    //Background Image to use
    $config['backgroundimage'] = 'image.png';

    //Refresh Intervall for the Image Generator in seconds
    $config['syncintervall'] = 3;
   
   
    //SourceQuery config START
   
    //Initially enables SourceQuery
    $config['sqenable'] = false;
    //Font File Path for Listing all available Parameters for the given Source Query Server
    $config['sqlistfont'] = 'font/arial.ttf';
   
   
    /*
        Source Query Integration
        Uses Library from https://github.com/xPaw/PHP-Source-Query
        A List of Supported Games in the link above
   
     Example for SourceQuery*/
   
    /*
        $config['sourcequery']['server1'] = [
            //IP from Server
            'ip' => '5.104.104.99',
            //Port for Source Query
            'port' => '2303',
            //Timeout
            'timeout' => 1,
            //with this on true it will List all Available fields you can use directly on the banner
            'debug' => false,
        ];
       
    */
   
    //SourceQuery config END
   
   

    /*
    ** Textfields
    ** text         = The Text which should be in the Field (all Available Placeholders on top of the config.php)
    ** xpos         = The X Position where the Textfield is located (in Pixel)
    ** ypos         = The Y Position where the Textfield is located (in Pixel)
    ** fontsize     = The Fontsize the Text should have
    ** fontfile     = The Font you want to use for the Text
    ** color        = Hex Color of the Font (Like: #34495e)
   
    ** EMPTY PRESET
   
        $config['textfield'][] = [
            'text' => '',
            'xpos' => '',
            'ypos' => '',
            'fontsize' => '',
            'fontfile' => 'font/bank.ttf',
            'color' => '',
        ];
       
    */
   
   
//    $config['textfield'][] = [
//        text' => 'Date:',
//        xpos' => '145',
//        ypos' => '47',
//        fontsize' => '14',
//        fontfile' => 'font/bank.ttf',
//        color' => '#ecf0f1',
//    ];
   
    $config['textfield'][] = [
        'text' => '%date%',
        'xpos' => '116',
        'ypos' => '118',
        'fontsize' => '20',
        'fontfile' => 'font/arialbd.ttf',
        'color' => '#FFFFFF',
    ];
   
//    $config['textfield'][] = [
//        text' => 'Hours:',
//        xpos' => '597',
//        ypos' => '47',
//        fontsize' => '24',
//        fontfile' => 'font/bank.ttf',
//        color' => '#ecf0f1',
//    ];
   
    $config['textfield'][] = [
        'text' => '%timeHi%',
        'xpos' => '131',
        'ypos' => '180',
        'fontsize' => '20',
        'fontfile' => 'font/arialbd.ttf',
        'color' => '#FFFFFF',
    ];
   
//    $config['textfield'][] = [
//        text' => '%groupcount[19]%',
//        xpos' => '150',
//        ypos' => '350',
//        fontsize' => '24',
//        fontfile' => 'font/bank.ttf',
//        color' => '#34495e',
//    ];

    $config['textfield'][] = [
        'text' => '%groupcount[19]%',
        'xpos' => '157',
        'ypos' => '360',
        'fontsize' => '20',
        'fontfile' => 'font/arialbd.ttf',
        'color' => '#FFFFFF',
    ];
   
    $config['textfield'][] = [
        'text' => '%groupcount[9,12,13,14,15,16,17]%',
        'xpos' => '157',
        'ypos' => '300',
        'fontsize' => '20',
        'fontfile' => 'font/arialbd.ttf',
        'color' => '#FFFFFF',
    ];
   
//    $config['textfield'][] = [
//        'text' => 'Users:',
//        'xpos' => '140',
//        'ypos' => '147',
//        'fontsize' => '24',
//        'fontfile' => 'font/bank.ttf',
//        'color' => '#ecf0f1',
//    ];
   
    $config['textfield'][] = [
        'text' => '%groupcount[11,22,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049]%',
        'xpos' => '150',
        'ypos' => '238',
        'fontsize' => '20',
        'fontfile' => 'font/arialbd.ttf',
        'color' => '#FFFFFF',
    ];
   
//    $config['textfield'][] = [/%maxclients%
//        'text' => 'Platform:',
//        'xpos' => '600',
//        'ypos' => '247',
//        'fontsize' => '24',
//        'fontfile' => 'font/bank.ttf',
//        'color' => '#ecf0f1',
//    ];
   
      $config['textfield'][] = [
          'text' => 'Ping:',
          'xpos' => '215',
          'ypos' => '398',
          'fontsize' => '12',
          'fontfile' => 'font/arialbd.ttf',
          'color' => '#FFFFFF',
      ];
   
      $config['textfield'][] = [
          'text' => '%ping_floored% MS',
          'xpos' => '260',
          'ypos' => '398',
          'fontsize' => '11',
          'fontfile' => 'font/arialbd.ttf',
          'color' => '#FFFFFF',
      ];
   
 
      /*
          Display Clients Nickname
      */
      $config['textfield'][] = [
          'text' => 'Welcome',
          'xpos' => '41',
          'ypos' => '45',
          'fontsize' => '13',
          'fontfile' => 'font/arialbd.ttf',
          'color' => '#FFFFFF',
      ];

      $config['textfield'][] = [
          'text' => '%nickname%',
          'xpos' => '35',
          'ypos' => '70',
          'fontsize' => '16',
          'fontfile' => 'font/arialbd.ttf',
          'color' => '#FFFFFF',
      ];

    */
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
@Multivit4min I don't know your code but shouldn't it be easy to modify it so the background will get selected through a switch and a random number?

PHP Example:
PHP:
$picturenum = rand(1, 3);
switch ($picturenum) {
 case 1:
  $picture = "/img/pic1.png";
 break;
 case 2:
 $picture = "/img/pic2.png";
 break;
 case 3:
 $picture = "/img/pic3.png";
 break;
}
 

Multivit4min

Member
Sep 2, 2015
27
49
53
The main Reason i havent implemented it yet is because i dont have the time since i am working on my own TeamSpeak Panel ;)
 
Top