Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // ==========================================================
- //
- // Name: COD/GTA-SAMP Server Banners
- //
- // Description: Standalone server banner code for MW1/2/3, WAW and GTA-SAMP.
- // Default requirements can be obtained
- // from: http://momo.blackpulse.us/banner/
- // You might need to do some changes to the font code (line 252)
- // Initial author: momo5502 <MauriceHeumann@googlemail.com>
- // Version: 5.3
- // License: Copyright © 2013 momo5502 (Only for private/non-commercial use)
- // Credit:
- // -PHP.net as a helpful resource
- // -PixelDemon/alexdahlem for his amazing gdlib tut
- // -BlooDONE for his background watermark
- // -aG`Avail for the online generator (http://momo5504.square7.de/banner.html)
- // -icedream for the api
- // -Richard Perry for some LGSL images
- //
- // ==========================================================
- //Display document as png
- if ( $_GET[ 'debug' ] != "1" )
- header( "Content-Type: image/png" );
- //Get basic information
- if ( isset( $_GET[ 'address' ] ) && $_GET[ 'address' ] != "" ) {
- $address = $_GET[ "address" ];
- $ip = substr( $address, 0, strpos( $address, ":" ) );
- $port = substr( $address, strpos( $address, ":" ) + 1 );
- }
- else if ( isset( $_GET[ 'adress' ] ) && $_GET[ 'adress' ] != "" ) //OMG a typo - Thx for remarking, Storm
- {
- $address = $_GET[ "adress" ];
- $ip = substr( $address, 0, strpos( $address, ":" ) );
- $port = substr( $address, strpos( $address, ":" ) + 1 );
- }
- else {
- $ip = $_GET[ 'ip' ];
- $port = $_GET[ 'port' ];
- }
- //Command that gets written.
- //$cmd = "\xFF\xFF\xFF\xFFgetstatus\x00";
- $cmd = "\xFF\xFF\xFF\xFFgetinfo\x00";
- if ( $_GET[ "game" ] == "SAMP" ) {
- $aIPAddr = explode( '.', $ip );
- $cmd = "SAMP";
- $cmd .= chr( $aIPAddr[ 0 ] );
- $cmd .= chr( $aIPAddr[ 1 ] );
- $cmd .= chr( $aIPAddr[ 2 ] );
- $cmd .= chr( $aIPAddr[ 3 ] );
- $cmd .= chr( $port & 0xFF );
- $cmd .= chr( $port >> 8 & 0xFF );
- $cmd .= 'i';
- }
- //Define the root folder for the external requirements (map previews and image background)
- $root = "banner/";
- if ( $_GET[ "game" ] != "SAMP" ) {
- $connection = getQueryData( $ip, $port, $cmd, true );
- $info = parseQueryData( $connection, $ip, $port, $cmd );
- }
- else {
- $info = querySAMP( $ip, $port, $cmd );
- }
- printimage( $info, $root );
- //Open socket connection, send and receive information, return it & close socket again!
- function getQueryData( $ip, $port, $send, $MW3 )
- {
- $server = "udp://" . $ip;
- $connect = @fsockopen( $server, $port, $errno, $errstr, 2 );
- if ( !$connect )
- return "-1";
- else {
- fwrite( $connect, $send );
- stream_set_timeout( $connect, 2 );
- $output = fread( $connect, 8192 );
- $info = stream_get_meta_data( $connect );
- fclose( $connect );
- if ( $_GET[ 'debug' ] == "1" )
- echo "<big><u>Server response:</u></big><br><br>" . substr( $output, 4 ) . "<br><br><big><u>PNG output:</u></big><br><br>";
- if ( !$output || !isset( $output ) || $output == "" || $info[ 'timed_out' ] ) {
- if ( $MW3 )
- return getMW3Port( $ip, $port, $send );
- else
- return "-1";
- }
- else
- return substr( $output, 4 );
- }
- }
- //MW3 servers use a different port system than other cods
- function getMW3Port( $ip, $port, $cmd )
- {
- //It uses icedreams api, therefore it only works with 4D1's MW3 servers
- if ( $fp = @fopen( 'http://s.mufff.in/api/cache', 'r' ) ) {
- $content = '';
- while ( $line = fgets( $fp, 1024 ) ) {
- $content .= $line;
- }
- $data = json_decode( $content );
- $n = count( $data->iw5m->ListedServers );
- $i = 0;
- while ( $i < $n ) {
- if ( $ip == $data->iw5m->ListedServers[ $i ]->IPString && $port == $data->iw5m->ListedServers[ $i ]->Ports[ 1 ] ) {
- return getQueryData( $ip, $data->iw5m->ListedServers[ $i ]->Ports[ 0 ], $cmd, false );
- }
- $i++;
- }
- return "-1";
- } else {
- return "-1";
- }
- }
- //Insert server information into my database.
- function insertToDatabase( $info, $width )
- {
- if ( isset( $_GET[ 'address' ] ) && $_GET[ 'address' ] != "" ) {
- $address = $_GET[ "address" ];
- $ip = substr( $address, 0, strpos( $address, ":" ) );
- $port = substr( $address, strpos( $address, ":" ) + 1 );
- }
- else if ( isset( $_GET[ 'adress' ] ) && $_GET[ 'adress' ] != "" ) //OMG a typo - Thx for remarking, Storm
- {
- $address = $_GET[ "adress" ];
- $ip = substr( $address, 0, strpos( $address, ":" ) );
- $port = substr( $address, strpos( $address, ":" ) + 1 );
- }
- else {
- $ip = $_GET[ 'ip' ];
- $port = $_GET[ 'port' ];
- }
- if ( $info[ 'value' ] != "-1" ) {
- if ( $fp = fopen( 'http://momo5504.square7.de/banner_stuff/sql.php?ip=' . $ip . '&port=' . $port . '&width=' . $width . '&color=' . $_GET[ "color" ] . '&game=' . $_GET[ "game" ], 'r' ) )
- fclose( $fp );
- }
- }
- //Get the width of a banner stored in my database, if a server is not reachable.
- function getOfflineWidth( )
- {
- if ( isset( $_GET[ 'address' ] ) && $_GET[ 'address' ] != "" ) {
- $address = $_GET[ "address" ];
- $ip = substr( $address, 0, strpos( $address, ":" ) );
- $port = substr( $address, strpos( $address, ":" ) + 1 );
- }
- else if ( isset( $_GET[ 'adress' ] ) && $_GET[ 'adress' ] != "" ) //OMG a typo - Thx for remarking, Storm
- {
- $address = $_GET[ "adress" ];
- $ip = substr( $address, 0, strpos( $address, ":" ) );
- $port = substr( $address, strpos( $address, ":" ) + 1 );
- }
- else {
- $ip = $_GET[ 'ip' ];
- $port = $_GET[ 'port' ];
- }
- $fp = fopen( 'http://momo5504.square7.de/banner_stuff/getWidth.php?ip=' . $ip . '&port=' . $port, 'r' );
- $content = '';
- while ( $line = fgets( $fp, 1024 ) ) {
- $content .= $line;
- }
- fclose( $fp );
- return floatval( substr( $content, 0, strpos( $content, "\n" ) ) );
- }
- //Parse the query data and return it as array.
- function parseQueryData( $input, $ip, $port, $cmd )
- {
- $server = $ip . ":" . $port;
- $err = "-";
- if ( $input == "-1" )
- $data = array(
- "value" => $input,
- "gametype" => $err,
- "protocol" => $err,
- "clients" => $err,
- "maxclients" => $err,
- "mapname" => $err,
- "server" => $server
- );
- else {
- //New segmentation code
- if ( $cmd == "\xFF\xFF\xFF\xFFgetstatus\x00" ) {
- $hostname = substr( $input, strpos( $input, "\\sv_hostname" ) + 13 );
- $players = count( getPlayers( $input ) );
- $gametype = substr( $input, strpos( $input, "\\g_gametype" ) + 12 );
- }
- else {
- $hostname = substr( $input, strpos( $input, "\\hostname" ) + 10 );
- if ( strpos( $input, "\\clients" ) ) {
- $players = substr( $input, strpos( $input, "\\clients" ) + 9 );
- $players = cleanFromRest( $players );
- }
- else
- $players = "-";
- $gametype = substr( $input, strpos( $input, "\\gametype" ) + 10 );
- }
- $maxplayers = substr( $input, strpos( $input, "\\sv_maxclients" ) + 15 );
- $maxplayers = cleanFromRest( $maxplayers );
- $mapname = substr( $input, strpos( $input, "\\mapname" ) + 9 );
- $mapname = cleanFromRest( $mapname );
- $hostname = cleanFromRest( $hostname );
- $gametype = cleanFromRest( $gametype );
- $protocol = substr( $input, strpos( $input, "\\protocol" ) + 10 );
- $protocol = cleanFromRest( $protocol );
- //Get a clean hostname without '^1's or '^5's
- $unclean = $hostname;
- for ( $i = 0; $i < 10; $i++ )
- $hostname = str_replace( "^{$i}", "", $hostname );
- $value = 1;
- //Put information into an array
- $data = array(
- "value" => $value,
- "hostname" => $hostname,
- "gametype" => $gametype,
- "protocol" => $protocol,
- "clients" => $players,
- "maxclients" => $maxplayers,
- "mapname" => $mapname,
- "server" => $server,
- "unclean" => $unclean
- );
- }
- return $data;
- }
- function getErr( $ip, $port )
- {
- $server = $ip . ":" . $port;
- $err = "-";
- $data = array(
- "value" => "-1",
- "gametype" => $err,
- "protocol" => $err,
- "clients" => $err,
- "maxclients" => $err,
- "mapname" => $err,
- "server" => $server
- );
- return $data;
- }
- function querySAMP( $ip, $port, $send )
- {
- $server = "udp://" . $ip;
- $connect = @fsockopen( $server, $port, $errno, $errstr, 2 );
- $fp = $connect;
- $server = $ip . ":" . $port;
- if ( !$connect || !$fp )
- $data = getErr( $ip, $port );
- else {
- fwrite( $connect, $send );
- fwrite( $fp, $send );
- stream_set_timeout( $connect, 2 );
- $output = fread( $fp, 11 );
- $info = stream_get_meta_data( $connect );
- if ( !$output || !isset( $output ) || $output == "" || $info[ 'timed_out' ] )
- $data = getErr( $ip, $port );
- else {
- $is_passworded = ord( fread( $fp, 1 ) );
- $plr_count = ord( fread( $fp, 2 ) );
- $firstval = dechex( ord( fread( $fp, 1 ) ) );
- $maxplayers = hexdec( dechex( ord( fread( $fp, 1 ) ) ) . $firstval );
- $max_plrs = $maxplayers;
- $strlen = ord( fread( $fp, 4 ) );
- $hostname = fread( $fp, $strlen );
- $strlen = ord( fread( $fp, 4 ) );
- $gamemode = fread( $fp, $strlen );
- $strlen = ord( fread( $fp, 4 ) );
- $mapname = fread( $fp, $strlen );
- $data = array(
- "value" => $output,
- "hostname" => $hostname,
- "gametype" => $gamemode,
- "protocol" => "SAMP",
- "clients" => $plr_count,
- "maxclients" => $max_plrs,
- "mapname" => $mapname,
- "server" => $server,
- "unclean" => $hostname
- );
- }
- }
- if( $connect )
- fclose( $connect );
- if ( $_GET[ 'debug' ] == "1" )
- echo "" . print_r( $data ) . "<br><br><big><u>PNG output:</u></big><br><br>";
- return $data;
- }
- //Clean input part from their rest behind
- function cleanFromRest( $self )
- {
- if ( strpos( $self, "\\" ) )
- return substr( $self, 0, strpos( $self, "\\" ) );
- else
- return $self;
- }
- //Get the players
- function getPlayers( $input )
- {
- $player_str = substr( $input, strpos( $input, "\n" ) + 1, strlen( $input ) );
- $player_str = substr( $player_str, strpos( $player_str, "\n" ) + 1, strlen( $player_str ) );
- $players = array( );
- $ZOB = substr_count( $player_str, "\n" );
- $tok = strtok( $player_str, "\"" );
- for ( $k = 1; $k <= $ZOB; $k++ ) {
- $score = substr( $tok, 0, strpos( $tok, " " ) );
- if ( substr( $score, 0, 1 ) == " " || substr( $score, 0, 1 ) == "\n" )
- $score = substr( $score, 1, strlen( $score ) );
- $ping = substr( $tok, strpos( $tok, " " ) + 1, strlen( $input ) );
- if ( substr( $ping, 0, 1 ) == " " || substr( $ping, 0, 1 ) == "\n" )
- $ping = substr( $ping, 0, strlen( $ping ) - 1 );
- $tok = strtok( "\"\n" );
- $name = $tok;
- $p_array = array(
- name => $name,
- score => $score,
- ping => $ping
- );
- array_push( $players, $p_array );
- $tok = strtok( "\"" );
- }
- return $players;
- }
- //Generate the image
- function printimage( $data, $root )
- {
- $font_size = 13;
- //Font can't be retrieved remotly, so I need to store it on a local server :(
- $fontpath = "font.ttf";
- $char_width = 9.5;
- if ( isset( $_GET[ 'width' ] ) && $_GET[ 'width' ] != "" && $_GET[ 'width' ] != "no" )
- $image_width = $_GET[ 'width' ];
- else {
- if ( $data[ 'value' ] == "-1" )
- //$image_width = getOfflineWidth();
- $image_width = 400;
- //Automated width detector - multiplies the string length by 10 (approximatly the font width)
- else
- $image_width = 167 + strlen( $data[ 'hostname' ] ) * $char_width;
- }
- //echo $image_width;
- if ( $image_width < 400 )
- $image_width = 400;
- $image_width = round( $image_width, 0 );
- insertToDatabase( $data, $image_width );
- $image_height = 100;
- $imagecontainer = imagecreatetruecolor( $image_width, $image_height );
- imagesavealpha( $imagecontainer, true );
- $game = getGameEngine( $data[ 'protocol' ] );
- $map = getMapName( $data[ 'mapname' ], $game );
- $gametype = getGametype( $data[ 'gametype' ], $game );
- $mappath = $root . "maps/" . $game . "/preview_" . $data[ 'mapname' ] . ".jpg";
- if ( $data[ 'value' ] == "-1" )
- $mapimage = imagecreatefromjpeg( $root . "maps/no_response.jpg" );
- else if ( check_file( $mappath ) )
- $mapimage = imagecreatefromjpeg( $mappath );
- else
- $mapimage = imagecreatefromjpeg( $root . "maps/no_image.jpg" );
- if ( ( !isSet( $_GET[ 'color' ] ) || $_GET[ 'color' ] == "no" ) && $data[ 'value' ] != "-1" )
- $bgcolor = AllocateAverageColor( $imagecontainer, $mapimage );
- else {
- $html_color = $_GET[ 'color' ];
- if ( !isset( $_GET[ 'color' ] ) || $_GET[ 'color' ] == "" ) {
- $html_color = "404040";
- if ( strpos( $html_color, "#" ) )
- $html_color = substr( $html_color, 1 );
- }
- $bgcolor = ImageColorAllocateFromHex( $imagecontainer, $html_color );
- }
- $bg = imagecreatefrompng( $root . "bg.png" );
- imagefill( $imagecontainer, 0, 0, $bgcolor );
- imagelayereffect( $imagecontainer, IMG_EFFECT_OVERLAY );
- imagecopyresampled( $imagecontainer, $bg, 0, 0, 0, 0, $image_width, $image_height, 100, 100 );
- imagelayereffect( $imagecontainer, IMG_EFFECT_NORMAL );
- //Some colors
- $white = Imagecolorallocate( $imagecontainer, 255, 255, 255 );
- $gray = Imagecolorallocate( $imagecontainer, 127, 127, 127 );
- $red = Imagecolorallocate( $imagecontainer, 255, 0, 0 );
- //Add preview to the container
- imagecopyresampled( $imagecontainer, $mapimage, 15, 15, 0, 0, 123, 70, imagesx( $mapimage ), imagesy( $mapimage ) );
- //Print this if the server is not reachable!
- if ( $data[ 'value' ] == "-1" ) {
- $text = "Server is offline!";
- imagettftext( $imagecontainer, $font_size, 0, 150, 30, $red, $fontpath, $text );
- //I must add a little watermark :P
- $watermark = imagecreatefrompng( $root . "engine/watermark.png" );
- imagecopyresampled( $imagecontainer, $watermark, $image_width - 75, 60, 0, 0, 63, 35, 320, 176 );
- }
- //Print this if it is!
- else {
- $gamepath = $root . "engine/" . $game . ".PNG";
- $cleanname = $data[ 'hostname' ];
- //Print the information onto the picture
- if ( check_file( $gamepath ) ) {
- $gameimage = imagecreatefrompng( $gamepath );
- imagecopyresampled( $imagecontainer, $gameimage, $image_width - 75, 60, 0, 0, 63, 35, 320, 176 );
- }
- //Colored hostname
- $length = 150;
- $color = $white;
- $maxlen = strlen( $data[ 'unclean' ] );
- $dots = false;
- if ( $_GET[ 'width' ] != "" && isset( $_GET[ 'width' ] ) && ( 167 + strlen( $data[ 'hostname' ] ) * $char_width ) > $_GET[ 'width' ] ) {
- $dots = true;
- $maxlen -= round( ( ( 195 + strlen( $data[ 'hostname' ] ) * $char_width ) - floatval( $_GET[ 'width' ] ) ) / $char_width, 0 ) + 3;
- }
- for ( $i = 0; $i <= $maxlen; $i++ ) {
- if ( $data[ 'unclean' ][ $i ] == "^" && $_GET["game"] != "SAMP" ) {
- $tempcolor = getColorfromNumber( $data[ 'unclean' ][ $i + 1 ], $imagecontainer );
- if ( $tempcolor == "-1" ) {
- imagettftext( $imagecontainer, $font_size, 0, $length, 30, $color, $fontpath, $data[ 'unclean' ][ $i ] );
- $length += $char_width;
- }
- else {
- $color = $tempcolor;
- $i++;
- }
- }
- else {
- imagettftext( $imagecontainer, $font_size, 0, $length, 30, $color, $fontpath, $data[ 'unclean' ][ $i ] );
- $length += $char_width;
- }
- }
- if ( $dots )
- imagettftext( $imagecontainer, $font_size, 0, $length, 30, $white, $fontpath, "..." );
- }
- $mapshadow = imagecreatefrompng( $root . "maps/shadow.png" );
- imagecopyresampled( $imagecontainer, $mapshadow, 15, 15, 0, 0, 126, 73, 334, 194 );
- imagettftext( $imagecontainer, 10, 0, 150, 47, $white, $fontpath, "IP: {$data[ 'server' ]}\nMap: {$map}\nGametype: " . strtoupper( $gametype ) . "\nPlayers: {$data[ 'clients' ]}/{$data[ 'maxclients' ]}" );
- //Render the final picture
- imagepng( $imagecontainer );
- imagedestroy( $imagecontainer );
- }
- function getColorfromNumber( $number, $imagecontainer )
- {
- switch ( floatval( $number ) ) {
- case ( 0 ):
- return Imagecolorallocate( $imagecontainer, 0, 0, 0 );
- break;
- case ( 1 ):
- return Imagecolorallocate( $imagecontainer, 255, 0, 0 );
- break;
- case ( 2 ):
- return Imagecolorallocate( $imagecontainer, 0, 255, 0 );
- break;
- case ( 3 ):
- return Imagecolorallocate( $imagecontainer, 255, 255, 0 );
- break;
- case ( 4 ):
- return Imagecolorallocate( $imagecontainer, 0, 0, 255 );
- break;
- case ( 5 ):
- return Imagecolorallocate( $imagecontainer, 0, 255, 255 );
- break;
- case ( 6 ):
- return Imagecolorallocate( $imagecontainer, 255, 0, 255 );
- break;
- case ( 7 ):
- return Imagecolorallocate( $imagecontainer, 255, 255, 255 );
- break;
- case ( 8 ):
- return Imagecolorallocate( $imagecontainer, 204, 153, 51 );
- break;
- case ( 9 ):
- return Imagecolorallocate( $imagecontainer, 141, 141, 141 );
- break;
- default:
- return "-1";
- }
- }
- //Get the game version
- function getGameEngine( $var )
- {
- if ( $_GET[ "game" ] == "SAMP" )
- return "SAMP";
- else if ( $_GET[ "game" ] == "MC" )
- return "Minecraft";
- switch ( $var ) {
- case ( "5" ):
- case ( "6" ):
- return "MW1"; // IW3 engine
- break;
- case ( "101" ):
- return "WAW"; // IW3 engine
- break;
- case ( "118" ):
- return "COD2";
- break;
- case ( "142" ): // (g)a(y)Rev protocol (info query)
- case ( "144" ): // (g)a(y)Rev protocol (status query)
- case ( "61586" ):
- return "MW2"; // IW4 engine
- break;
- case ( "104" ):
- case ( "19816" ):
- return "MW3"; // IW5 engine
- break;
- default:
- return $var;
- break;
- }
- }
- //Get better GT names
- function getGametype( $var, $game )
- {
- switch ( $var ) {
- case ( "war" ):
- if ( $game == "WAW" ) //WAW gametype war is not IW's TDM
- return "WAR";
- else
- return "TDM";
- break;
- case ( "dm" ):
- return "FFA";
- break;
- case ( "dd" ):
- return "DEM";
- break;
- case ( "sd" ):
- return "S&D";
- break;
- default:
- return $var;
- break;
- }
- }
- //Get the localized mapname
- function getMapName( $var, $game )
- {
- if ( $fp = fopen( 'http://momo5504.square7.de/banner_stuff/getMap.php?mapname=' . $var . '&game=' . $game, 'r' ) ) {
- $content = '';
- while ( $line = fgets( $fp, 1024 ) ) {
- $content .= $line;
- }
- if ( $content == "" )
- return $var;
- else {
- if ( strpos( $content, "\n" ) )
- return substr( $content, 0, strpos( $content, "\n" ) );
- else
- return $content;
- }
- } else
- return $var;
- }
- //Checks if a file exists and returns boolean true or false
- function check_file( $file )
- {
- if ( substr( $file, 0, 7 ) == "http://" ) {
- $file_headers = @get_headers( $file );
- if ( $file_headers[ 0 ] == 'HTTP/1.1 404 Not Found' )
- return false;
- else
- return true;
- } else
- return file_exists( $file );
- }
- //Allocates a color from a HEX color ( e.g. #00FF4B )
- function ImageColorAllocateFromHex( $img, $hexstr )
- {
- $int = hexdec( $hexstr );
- return ImageColorAllocate( $img, 0xFF & ( $int >> 0x10 ), 0xFF & ( $int >> 0x8 ), 0xFF & $int );
- }
- //Allocates the average color of the given image (all colors / amount)
- function AllocateAverageColor( $img, $i )
- {
- $max_x = imagesx( $i );
- $max_y = imagesy( $i );
- for ( $x = 0; $x < $max_x; $x++ ) {
- for ( $y = 0; $y < $max_y; $y++ ) {
- $rgb = imagecolorat( $i, $x, $y );
- $rTotal += ( $rgb >> 16 ) & 0xFF;
- $gTotal += ( $rgb >> 8 ) & 0xFF;
- $bTotal += $rgb & 0xFF;
- }
- }
- $total = $max_x * $max_y;
- $rAverage = round( $rTotal / $total );
- $gAverage = round( $gTotal / $total );
- $bAverage = round( $bTotal / $total );
- return ImageColorAllocate( $img, $rAverage, $gAverage, $bAverage );
- }
- //Allocates the most dominant color of a given image
- function AllocateDominantColor( $img, $i )
- {
- $colours = array( );
- $index = array( );
- for ( $x = 1; $x < imagesx( $i ); $x++ ) {
- for ( $y = 1; $y < imagesy( $i ); $y++ ) {
- $int = imagecolorat( $i, $x, $y );
- $key = ( 0xFF & ( $int >> 0x10 ) ) . " " . ( 0xFF & ( $int >> 0x8 ) ) . " " . ( 0xFF & $int );
- if ( !isSet( $colours[ $key ] ) ) {
- $colours[ $key ] = 1;
- } else {
- $colours[ $key ]++;
- }
- }
- }
- arsort( $colours, SORT_NUMERIC );
- $r = substr( key( $colours ), 0, strpos( key( $colours ), " " ) );
- $g = substr( substr( key( $colours ), strpos( key( $colours ), " " ) + 1 ), 0, strpos( key( $colours ), " " ) );
- $b = substr( substr( substr( key( $colours ), strpos( key( $colours ), " " ) + 1 ), strpos( key( $colours ), " " ) + 1 ), 0, strpos( key( $colours ), " " ) );
- return ImageColorAllocate( $img, $r, $g, $b );
- }
- //Allocates a random color in a given image
- function AllocateRandColor( $img, $i )
- {
- $x = rand() % imagesx( $i );
- $y = rand() % imagesy( $i );
- $rgb = imagecolorat( $i, $x, $y );
- return $rgb;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement