consistent plugin usage - gravatar
this and followup commits touches: use load_languiage API class method parenthesis "\n{\n <code>\n}\n", case break switches, consistent boolean usage, append css to eventData and other cleanups
This commit is contained in:
parent
34cefef45f
commit
adfb3bc537
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
function build_monster($filename, $seed='',$size=''){
|
function build_monster($filename, $seed='',$size=''){
|
||||||
// init random seed
|
// init random seed
|
||||||
if($seed) srand( hexdec(substr(md5($seed),0,6)) );
|
if ($seed) srand( hexdec(substr(md5($seed),0,6)) );
|
||||||
|
|
||||||
// throw the dice for body parts
|
// throw the dice for body parts
|
||||||
$parts = array(
|
$parts = array(
|
||||||
@ -31,17 +31,17 @@ function build_monster($filename, $seed='',$size=''){
|
|||||||
imagedestroy($im);
|
imagedestroy($im);
|
||||||
|
|
||||||
// color the body
|
// color the body
|
||||||
if($part == 'body'){
|
if ($part == 'body') {
|
||||||
$color = imagecolorallocate($monster, rand(20,235), rand(20,235), rand(20,235));
|
$color = imagecolorallocate($monster, rand(20,235), rand(20,235), rand(20,235));
|
||||||
imagefill($monster,60,60,$color);
|
imagefill($monster,60,60,$color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore random seed
|
// restore random seed
|
||||||
if($seed) srand();
|
if ($seed) srand();
|
||||||
|
|
||||||
// resize if needed, then output
|
// resize if needed, then output
|
||||||
if($size && $size < 400){
|
if ($size && $size < 400) {
|
||||||
$out = @imagecreatetruecolor($size,$size);
|
$out = @imagecreatetruecolor($size,$size);
|
||||||
if (!$out) return false; // Problems creating image!
|
if (!$out) return false; // Problems creating image!
|
||||||
imagecopyresampled($out,$monster,0,0,0,0,$size,$size,120,120);
|
imagecopyresampled($out,$monster,0,0,0,0,$size,$size,120,120);
|
||||||
@ -49,10 +49,12 @@ function build_monster($filename, $seed='',$size=''){
|
|||||||
imagedestroy($out);
|
imagedestroy($out);
|
||||||
imagedestroy($monster);
|
imagedestroy($monster);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
} else {
|
||||||
//header ("Content-type: image/png");
|
//header ("Content-type: image/png");
|
||||||
imagepng($monster,$filename);
|
imagepng($monster,$filename);
|
||||||
imagedestroy($monster);
|
imagedestroy($monster);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
File diff suppressed because it is too large
Load Diff
@ -99,9 +99,9 @@ Builds the avatar.
|
|||||||
|
|
||||||
function wavatar_build ($filename, $seed, $size)
|
function wavatar_build ($filename, $seed, $size)
|
||||||
{
|
{
|
||||||
if (!function_exists (imagecreatetruecolor)) {
|
if (!function_exists (imagecreatetruecolor)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$face = 1 + (hexdec (substr ($seed, 1, 2)) % (WAVATAR_FACES));
|
$face = 1 + (hexdec (substr ($seed, 1, 2)) % (WAVATAR_FACES));
|
||||||
$bg_color = (hexdec (substr ($seed, 3, 2)) % 240);
|
$bg_color = (hexdec (substr ($seed, 3, 2)) % 240);
|
||||||
$fade = 1 + (hexdec (substr ($seed, 5, 2)) % (WAVATAR_BACKGROUNDS));
|
$fade = 1 + (hexdec (substr ($seed, 5, 2)) % (WAVATAR_BACKGROUNDS));
|
||||||
@ -142,4 +142,4 @@ function wavatar_build ($filename, $seed, $size)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -2,13 +2,13 @@
|
|||||||
require_once 'ycon.php';
|
require_once 'ycon.php';
|
||||||
|
|
||||||
function build_ycon($filename, $seed='',$size=''){
|
function build_ycon($filename, $seed='',$size=''){
|
||||||
$hash = md5($seed);
|
$hash = md5($seed);
|
||||||
$image = ycon($hash, $size, 255, 255, 255);
|
$image = ycon($hash, $size, 255, 255, 255);
|
||||||
imagetruecolortopalette($image, false, 64);
|
imagetruecolortopalette($image, false, 64);
|
||||||
// header('Content-type: image/png');
|
// header('Content-type: image/png');
|
||||||
imagepng($image,$filename);
|
imagepng($image,$filename);
|
||||||
imagedestroy($image);
|
imagedestroy($image);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -52,7 +52,7 @@ function ycon($hash, $size, $bg_red, $bg_green, $bg_blue)
|
|||||||
$red = hexdec(substr($hash, 0, 3)) % 12; // 0-192 for color
|
$red = hexdec(substr($hash, 0, 3)) % 12; // 0-192 for color
|
||||||
$green = hexdec(substr($hash, 3, 3)) % 12; // (in increments of 16)
|
$green = hexdec(substr($hash, 3, 3)) % 12; // (in increments of 16)
|
||||||
$blue = hexdec(substr($hash, 6, 3)) % 12;
|
$blue = hexdec(substr($hash, 6, 3)) % 12;
|
||||||
|
|
||||||
$corners = hexdec(substr($hash, 9, 1)) % 16; // 14 gylphs
|
$corners = hexdec(substr($hash, 9, 1)) % 16; // 14 gylphs
|
||||||
$corners_i = hexdec(substr($hash, 10, 1)) % 2; // inverted?
|
$corners_i = hexdec(substr($hash, 10, 1)) % 2; // inverted?
|
||||||
$corners_a = hexdec(substr($hash, 11, 1)) % 4; // 4 rotations
|
$corners_a = hexdec(substr($hash, 11, 1)) % 4; // 4 rotations
|
||||||
@ -93,7 +93,7 @@ function ycon($hash, $size, $bg_red, $bg_green, $bg_blue)
|
|||||||
|
|
||||||
$shape = (int)($center / 2);
|
$shape = (int)($center / 2);
|
||||||
$inverted = (($center % 2) == 0);
|
$inverted = (($center % 2) == 0);
|
||||||
|
|
||||||
draw_glpyh($draw_icon, $square, $square, $square, $color, $background, $shape, 0, $inverted);
|
draw_glpyh($draw_icon, $square, $square, $square, $color, $background, $shape, 0, $inverted);
|
||||||
|
|
||||||
imagecopyresampled($icon, $draw_icon, 0, 0, 0, 0, $size, $size, $draw_size, $draw_size);
|
imagecopyresampled($icon, $draw_icon, 0, 0, 0, 0, $size, $size, $draw_size, $draw_size);
|
||||||
@ -230,7 +230,7 @@ function draw_glpyh(&$image, $x, $y, $full, $fg_color, $bg_color, $shape, $rotat
|
|||||||
0, $full,
|
0, $full,
|
||||||
$full, 0);
|
$full, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 13: // squat diamond
|
case 13: // squat diamond
|
||||||
$points = array(
|
$points = array(
|
||||||
$quarter, 0,
|
$quarter, 0,
|
||||||
@ -238,7 +238,7 @@ function draw_glpyh(&$image, $x, $y, $full, $fg_color, $bg_color, $shape, $rotat
|
|||||||
$quarter, $full,
|
$quarter, $full,
|
||||||
0, $half);
|
0, $half);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 14: // hourglass on its side (and kinda' squished...)
|
case 14: // hourglass on its side (and kinda' squished...)
|
||||||
$points = array(
|
$points = array(
|
||||||
0, $half,
|
0, $half,
|
||||||
@ -253,7 +253,7 @@ function draw_glpyh(&$image, $x, $y, $full, $fg_color, $bg_color, $shape, $rotat
|
|||||||
$half, $half,
|
$half, $half,
|
||||||
$half, $full);
|
$half, $full);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
die('$shape must be in range [0..13] (' . $shape . ' is out of range)');
|
die('$shape must be in range [0..13] (' . $shape . ' is out of range)');
|
||||||
}
|
}
|
||||||
@ -282,4 +282,5 @@ function draw_glpyh(&$image, $x, $y, $full, $fg_color, $bg_color, $shape, $rotat
|
|||||||
// draw the bastard
|
// draw the bastard
|
||||||
imagefilledpolygon($image, $points, count($points) / 2, $drawing_color);
|
imagefilledpolygon($image, $points, count($points) / 2, $drawing_color);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user