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=''){
|
||||
// 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
|
||||
$parts = array(
|
||||
@ -31,17 +31,17 @@ function build_monster($filename, $seed='',$size=''){
|
||||
imagedestroy($im);
|
||||
|
||||
// color the body
|
||||
if($part == 'body'){
|
||||
if ($part == 'body') {
|
||||
$color = imagecolorallocate($monster, rand(20,235), rand(20,235), rand(20,235));
|
||||
imagefill($monster,60,60,$color);
|
||||
}
|
||||
}
|
||||
|
||||
// restore random seed
|
||||
if($seed) srand();
|
||||
if ($seed) srand();
|
||||
|
||||
// resize if needed, then output
|
||||
if($size && $size < 400){
|
||||
if ($size && $size < 400) {
|
||||
$out = @imagecreatetruecolor($size,$size);
|
||||
if (!$out) return false; // Problems creating image!
|
||||
imagecopyresampled($out,$monster,0,0,0,0,$size,$size,120,120);
|
||||
@ -49,10 +49,12 @@ function build_monster($filename, $seed='',$size=''){
|
||||
imagedestroy($out);
|
||||
imagedestroy($monster);
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
//header ("Content-type: image/png");
|
||||
imagepng($monster,$filename);
|
||||
imagedestroy($monster);
|
||||
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)
|
||||
{
|
||||
if (!function_exists (imagecreatetruecolor)) {
|
||||
return false;
|
||||
}
|
||||
if (!function_exists (imagecreatetruecolor)) {
|
||||
return false;
|
||||
}
|
||||
$face = 1 + (hexdec (substr ($seed, 1, 2)) % (WAVATAR_FACES));
|
||||
$bg_color = (hexdec (substr ($seed, 3, 2)) % 240);
|
||||
$fade = 1 + (hexdec (substr ($seed, 5, 2)) % (WAVATAR_BACKGROUNDS));
|
||||
@ -142,4 +142,4 @@ function wavatar_build ($filename, $seed, $size)
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
@ -2,13 +2,13 @@
|
||||
require_once 'ycon.php';
|
||||
|
||||
function build_ycon($filename, $seed='',$size=''){
|
||||
$hash = md5($seed);
|
||||
$image = ycon($hash, $size, 255, 255, 255);
|
||||
imagetruecolortopalette($image, false, 64);
|
||||
// header('Content-type: image/png');
|
||||
imagepng($image,$filename);
|
||||
imagedestroy($image);
|
||||
return true;
|
||||
$hash = md5($seed);
|
||||
$image = ycon($hash, $size, 255, 255, 255);
|
||||
imagetruecolortopalette($image, false, 64);
|
||||
// header('Content-type: image/png');
|
||||
imagepng($image,$filename);
|
||||
imagedestroy($image);
|
||||
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
|
||||
$green = hexdec(substr($hash, 3, 3)) % 12; // (in increments of 16)
|
||||
$blue = hexdec(substr($hash, 6, 3)) % 12;
|
||||
|
||||
|
||||
$corners = hexdec(substr($hash, 9, 1)) % 16; // 14 gylphs
|
||||
$corners_i = hexdec(substr($hash, 10, 1)) % 2; // inverted?
|
||||
$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);
|
||||
$inverted = (($center % 2) == 0);
|
||||
|
||||
|
||||
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);
|
||||
@ -230,7 +230,7 @@ function draw_glpyh(&$image, $x, $y, $full, $fg_color, $bg_color, $shape, $rotat
|
||||
0, $full,
|
||||
$full, 0);
|
||||
break;
|
||||
|
||||
|
||||
case 13: // squat diamond
|
||||
$points = array(
|
||||
$quarter, 0,
|
||||
@ -238,7 +238,7 @@ function draw_glpyh(&$image, $x, $y, $full, $fg_color, $bg_color, $shape, $rotat
|
||||
$quarter, $full,
|
||||
0, $half);
|
||||
break;
|
||||
|
||||
|
||||
case 14: // hourglass on its side (and kinda' squished...)
|
||||
$points = array(
|
||||
0, $half,
|
||||
@ -253,7 +253,7 @@ function draw_glpyh(&$image, $x, $y, $full, $fg_color, $bg_color, $shape, $rotat
|
||||
$half, $half,
|
||||
$half, $full);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
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
|
||||
imagefilledpolygon($image, $points, count($points) / 2, $drawing_color);
|
||||
}
|
||||
?>
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user