<?php include_once "../functions_auth.php"; include_once "../admin_functions_db.php"; include_once "firemago_functions.php"; if (userIsGuilde() || userIsGroupSpec()) { $vue = $_REQUEST["Vue"]; $X = $_REQUEST["X"]; $Y = $_REQUEST["Y"]; $N = $_REQUEST["N"]; echo "try { \n"; echo "\n\t\t\t\tfunction piege(){\n\t\t\t\t\t\n\t\t\t\t\t\$('.fm_piege').each(function(index) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\$(this).css('background-color',colorUrg);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( \$(this).css('display') == 'none' )\n\t\t\t\t\t\t\t\$(this).show();\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\$(this).hide();\n\t\t\t\t\t\t\n\t\t\t\t\t});\t\n\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t"; echo "var anchorPlace = \$('html>body>table>tbody>tr:eq(1)>td>table>tbody>tr>td:eq(1)>p>table:eq(4)>tbody>tr:eq(1)');"; $sql = "SELECT * FROM ggc_piege WHERE abs(X-" . intval($X) . ") < 6 AND abs(Y-" . intval($Y) . ") < 6 AND abs(N-" . intval($N) . ") < 6;"; $pieges = mysql_query($sql, $db_vue_rm); if (mysql_error()) { echo "alert('" . mysql_error() . "');"; } if (mysql_num_rows($pieges) > 0) { while ($piege = mysql_fetch_assoc($pieges)) { $dist = getDist($X, $Y, $N, $piege["X"], $piege["Y"], $piege["N"]); echo "anchorPlace.after('<tr style=\"background-color:red;\"><td width=\"75\">" . $dist . "</td><td>Piège à " . $piege["type"] . "</td><td>" . addslashes($piege["date"] . " " . $piege["texte"]) . "</td><td align=\"center\">" . $piege["X"] . "</td><td align=\"center\">" . $piege["Y"] . "</td><td align=\"center\">" . $piege["N"] . "</td></tr>');"; if ($dist < 2) { echo "\n\t\t\t\t\t\t\t\tif ( \$('#table_piege').length == 0 )\n\t\t\t\t\t\t\t\t\t\$('html>body>table>tbody>tr:eq(1)>td>table>tbody>tr>td:eq(1)>p>table:eq(0)').before('<table id=\"table_piege\" class=\"mh_tdborder\" width=\"50%\"><tr style=\"background-color:red;\" onClick=\"piege();\" onMouseOver=\"this.style.cursor = \\'pointer\\';\"<td align=\"center\" colspan=\"6\">ATTENTION => Pièges à une cases de votre Troll !</td></tr></table><br/>');\n\t\t\t\t\t\t\t "; echo "\$(\"#table_piege\").append('<tr class=\"fm_piege\" style=\"display:none\" align=\"center\"><td>Dist : " . $dist . "</td><td>Type : " . $piege["type"] . "</td><td>" . addslashes($piege["date"] . " " . $piege["texte"]) . "</td><td>X:" . $piege["X"] . "</td><td>Y:" . $piege["Y"] . "</td><td>N" . $piege["N"] . "</td></tr>');"; } } } echo "} catch ( e ) { error ( e, 'Piege error' ); } \n"; }
$b = ($b + $m) * 255; return array(floor($r), floor($g), floor($b)); } $hueAdjustment = -180; $tar = array('red' => 47, 'green' => 116, 'blue' => 118); $img = imagecreatefrompng('core/imageColor/img.png'); $x = imagesx($img); $y = imagesy($img); $yMin = $y / 3; $yMax = $y * 2 / 3; $xMin = $x / 3; $xMax = $x * 2 / 3; $red = imagecolorallocate($img, 255, 0, 0); for ($i = $xMin; $i < $xMax; ++$i) { for ($j = $yMin; $j < $yMax; ++$j) { $ind = imagecolorat($img, $i, $j); $val = imagecolorsforindex($img, $ind); if (getDist($tar, $val) < 65) { $hsl = rgbToHsl($val['red'], $val['green'], $val['blue']); //$h = $hsv['H'] + .2; $h = $hsl[0] + $hueAdjustment; // if ($h > 1) --$h; $rgb = hslToRgb($h, $hsl[1], $hsl[2]); $newCol = imagecolorallocate($img, $rgb[0], $rgb[1], $rgb[2]); imagesetpixel($img, $i, $j, $newCol); } } } $file = 'core/imageColor/result.png'; imagepng($img, $file); echo '<img src="' . $file . '">';