I kinda prefer html over gd2. So here is the function that should ease up the converting of guild logos to a regular display in your web page.
Note that this works with all php versions and does not require the gd2 php extension to be loaded( it has performance issues + it is bigger in output size )
so i've created this little php function that should do the job and decided to share it
Create a file in your web root called sy_mark.php (for example) and fill the following code in it
Note that the code is well commented ^^
PHP Code:
<?php
/*
[ "MuMark to HTML" Script]
[ Author: Savoy]
[
savoy___@hotmail.com]
*/
// Create the function
function SYlogo($code,$xy=3) {
// Turn hex into dec
$code = urlencode(bin2hex($code));
$color[0] = ''; $color[1]='#000000'; $color[2]='#8c8a8d'; $color[3]='#ffffff'; $color[4]='#fe0000'; $color[5]='#ff8a00'; $color[6]='#ffff00'; $color[7]='#8cff01'; $color[8]='#00ff00'; $color[9]='#01ff8d'; $color['a']='#00ffff'; $color['b']='#008aff'; $color['c']='#0000fe'; $color['d']='#8c00ff'; $color['e']='#ff00fe'; $color['f']='#ff008c';
// Set the default zero position.
$i = 0;
$ii = 0;
// Create the table
$it = '<table style='width: '.(8*$xy).'px;height:'.(8*$xy).'px' border=0 cellpadding=0 cellspacing=0><tr>';
// Start the logo drawing cycle for each color slot
while ($i<64) {
// Get the slot color number
$place = $code{$i};
// Increase the slot
$i++;$ii++;
// Get the color of the slot
$add = $color[$place];
// Create the slot with its color
$it .= '<td class='guildlogo' style='background-color: '.$add.';' width=''.$xy.'' height=''.$xy.''></td>';
// In case we have a new line
if ($ii==
{
$it .= '</tr>';
if ($ii != 64) $it .='<tr>';
$ii =0;
}
}
// Finish the table off
$it .= '</table>';
// What do we output
return $it;
}
?>
How to use ? Its easy ..
just write down this in a file to test
PHP Code:
<?php
// Connect to database bullcrap - fill it in
require 'sy_mark.php';
$guild = 'TestGuildName'; // Change this to your guild name
// Using a regular query
$query = mssql_query("select [G_Mark] from [Guild] where [G_Name]='".$guild."'");
// Fetching the results as a dec array
$result = mssql_fetch_row($query);
// Fetching the first (& only) result - g_mark
$glogo = $result[0];
// Set a variable with the output text
$mylogo = SYlogo($glogo,3); // You can change 3 with the size (in pixels) you want each slot to have
// You want to display it ???
print $mylogo;
?>
*Tested and working, don't bother to post if you can't get it working - i've explained as well as i can*