function contraster(&$backgroundcolor, &$textcolor) { if ($textcolor == "#000000") { $c_backgroundcolor = new color(); $c_backgroundcolor->set_from_rgbhex(substr($backgroundcolor, 1, 6)); // il y a un bug dans la méthode set_from_rgbhex de la classe color (à cause de #) // je fixe ici en utilisant substr mais il faudrait le faire dans la classe //$c_backgroundcolor->set_from_rgb(0,0,255); //echo "avant="; //print_r($c_backgroundcolor->get_luv()); //echo "<br/>"; //echo "apres="; //print_r($c_backgroundcolor->get_luv()); //echo "<br/>"; $luv = $c_backgroundcolor->get_luv(); /* si la luminosité est supérieur à une certaine valeur on ne la change pas si elle est inférieur on la fixe à une constante */ $lum_min = 50; if ($luv[0] < $lum_min) { $luv[0] = $lum_min; } $c_backgroundcolor->set_from_luv($luv[0], $luv[1], $luv[2]); $backgroundcolor = "#" . $c_backgroundcolor->get_rgbhex(); } else { throw new Exception('Impossible car la couleur de texte n\'est pas noire !!!'); } }
function saveProfile($verify) { $sim = new simulator(); $handle = fopen("php://stdin", "r"); $pic = new photo(); $clr = new color(); echo "Enter Header Picture"; $this->temp = $pic->returnPhoto($verify); $size = count($this->temp); for ($x = 0; $x <= $size - 1; $x++) { echo $x . " " . $this->temp[$x] . "\n"; } echo "Press Number to add photo"; $pho = fgets($handle); $photo = "Header Picture: " . $this->temp[1]; echo "Enter Profile Picture"; for ($x = 0; $x <= $size - 1; $x++) { echo $x . " " . $this->temp[$x] . "\n"; } $ppho = fgets($handle); $pPhoto = "Profile Picture:" . $this->temp[1]; echo "Enter Full Name"; $full_name = fgets($handle); echo "Enter Bio"; $bio = fgets($handle); echo "Enter Location"; $location = fgets($handle); echo "Enter Website"; $website = fgets($handle); echo "Enter DOB "; $dob = fgets($handle); echo "Enter Theme Color"; $clrs = $clr->returnColors(); for ($x = 0; $x <= $size - 1; $x++) { echo $x . " " . $clrs[$x] . "\n"; } $t = fgets($handle); $theme_color = $clrs[1]; $myfile = fopen("{$verify}" . "profile", "w") or die("Unable to open file!"); fwrite($myfile, $photo . "\n" . $pPhoto . "\n" . $full_name . $bio . $location . $website . $dob . $theme_color); echo "Profile Made"; $sim->followUp($verify); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $insert = $request->all(); $safeName = false; //upload image if ($file = Input::file('image')) { $fileName = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension() ?: 'png'; $folderName = '/uploads/'; $destinationPath = Config::get('app.path') . $folderName; $safeName = time() . "_" . str_random(10) . '.' . $extension; $file->move($destinationPath, $safeName); $insert['image'] = $safeName ? $folderName . $safeName : ''; } if (isset(Color::$boolean)) { foreach (color::$boolean as $field) { if (isset($insert[$field]) && $insert[$field] == "on") { $insert[$field] = 1; } } } color::create($insert); return redirect('admin/colors')->with('success', Lang::get('message.success.create')); }
<?php include "../../../system.php"; include "../../system.php"; include "../../../function/new_function.php"; include "color_unit.php"; //System----------------------------------------------------------- $now_table = $pro_color_table; $related_table = $pro_stock_table; //System----------------------------------------------------------- $tool = new My_Tool(); $sam = new guard(); $unit = new color(); $id = $_POST['id']; $unit->table = $now_table; $unit->id = $id; $unit->del(); //刪除關聯紀錄 $sql = "DELETE from `{$related_table}` where cid='{$id}'"; mysql_query($sql);
$bg_color = explode('.', $x_pieces[1]); $bg_color = $bg_color[0]; if (!$bg_color) { $bg_color = ccc; //defaults to gray if no background color is set. } $background = new color(); $background->set_hex($bg_color); //Find the foreground color which is always after the 3rd slash in the url. $fg_color = explode('.', $x_pieces[2]); $fg_color = $fg_color[0]; if (!$fg_color) { $fg_color = 00; //defaults to black if no foreground color is set. } $foreground = new color(); $foreground->set_hex($fg_color); //Determine the file format. This can be anywhere in the URL. $file_format = 'gif'; preg_match_all('/(png|jpg|jpeg)/', $x, $result); if ($result[0][0]) { $file_format = $result[0][0]; } //Find the image dimensions if (substr_count($x_pieces[0], ':') > 1) { die('Too many colons in the dimension paramter! There should be 1 at most.'); } if (strstr($x_pieces[0], ':') && !strstr($x_pieces[0], 'x')) { die('To calculate a ratio you need to provide a height!'); } $dimensions = explode('x', $x_pieces[0]);
<?php require_once "class_color.inc.php"; $c = new color(); $c->set_from_rgb(224, 200, 226); echo "<table>\n"; echo "<tr>\n"; for ($i = 0; $i > -1; $i -= 0.05) { $c2 = new color(); $c2->set_from_rgb(224, 200, 226); $temp = $c2->get_hsl(); echo "avant:" . $temp[0] . " " . $temp[1] . " " . $temp[2]; $c2->mod_l_hsl($i); $temp = $c2->get_hsl(); echo "apres:" . $temp[0] . " " . $temp[1] . " " . $temp[2] . "<br>"; echo "<td bgcolor=#" . $c2->get_rgbhex() . "> </td>\n"; } echo "</tr>\n"; echo "</table>\n";
<?php $folder = ""; include_once "class/testimonio.php"; $testimonio = new testimonio(); $tes = $testimonio->mostrarTodoRegistro("", 1, ""); include_once "class/servicio.php"; $servicio = new servicio(); $ser = $servicio->mostrarTodoRegistro("", 1, "titulo"); include_once "class/color.php"; $color = new color(); $col = $color->mostrarTodoRegistro("", 1, "descripcion"); include_once "class/diseno.php"; $diseno = new diseno(); $dis = $diseno->mostrarTodoRegistro("", 1, "descripcion"); include_once "class/flores.php"; $flores = new flores(); $flo = $flores->mostrarTodoRegistro("", 1, "descripcion"); include_once "class/globos.php"; $globos = new globos(); $glo = $globos->mostrarTodoRegistro("", 1, "descripcion"); include_once "cabecerahtml.php"; ?> <script language="javascript" type="text/javascript"> $(document).on("ready",function(){ $(document).on("change",".pedido",cargar); cargar(); $(document).on("change","[name=fechaevento]",evento); evento(); }); function cargar(){
<?php include_once "../../login/check.php"; $folder = "../../"; $codcolor = $_POST['codcolor']; include_once "../../class/color.php"; $color = new color(); $col = $color->eliminarRegistro("codcolor=" . $codcolor);
<?php include_once "../../login/check.php"; $codreserva = $_GET['codreserva']; include_once "../../class/reserva.php"; $reserva = new reserva(); $res = $reserva->mostrarTodoRegistro("codreserva=" . $codreserva); $res = array_shift($res); include_once "../../class/servicio.php"; $servicio = new servicio(); $ser = $servicio->mostrarTodoRegistro("codservicio=" . $res['codservicio'], "1", "titulo"); $ser = array_shift($ser); include_once "../../class/color.php"; $color = new color(); $col = $color->mostrarTodoRegistro("codcolor=" . $res['codcolor'], 1, "descripcion"); $col = array_shift($col); include_once "../../class/diseno.php"; $diseno = new diseno(); $dis = $diseno->mostrarTodoRegistro("coddiseno=" . $res['coddiseno'], 1, "descripcion"); $dis = array_shift($dis); include_once "../../class/flores.php"; $flores = new flores(); $flo = $flores->mostrarTodoRegistro("codflores=" . $res['codflores'], 1, "descripcion"); $flo = array_shift($flo); include_once "../../class/globos.php"; $globos = new globos(); $glo = $globos->mostrarTodoRegistro("codglobos=" . $res['codglobos'], 1, "descripcion"); $glo = array_shift($glo); include_once "../../impresion/pdf.php"; $titulo = "Reporte de Evento"; class PDF extends PPDF
<?php require_once "class_color.inc.php"; $c = new color(); $step = 10; $type_test = "xyz"; if ($type_test == "xyz") { $max = array(95.047, 100, 108.883); } if ($type_test == "cmy" || $type_test == "cmyk") { $max = array(1, 1, 1); } if ($type_test == "luv") { $max = array(120, 255, 255); } if ($type_test == "hsl") { $max = array(1, 1, 1); } $steps[0] = $max[0] / $step; $steps[1] = $max[1] / $step; $steps[2] = $max[2] / $step; for ($v1 = 0; $v1 < $max[0]; $v1 += $steps[0]) { echo $v1 . "<br>\n"; echo "<table>\n"; for ($v2 = 0; $v2 < $max[1]; $v2 += $steps[1]) { echo "<tr>\n"; for ($v3 = 0; $v3 < $max[2]; $v3 += $steps[2]) { if ($type_test == "xyz") { $c->set_from_xyz($v1, $v2, $v3); $values = $c->get_xyz(); }
public function do_calculation() { if (is_nan($this->value)) { exit; } $data = array(); switch ($this->current_cal) { case 'srm': $this->data['srm'] = $this->value; $this->data['lovibond'] = ($this->value + 0.76) / 1.3546; $this->data['ebc'] = $this->value * 1.97; break; case 'lovibond': $this->data['srm'] = 1.3546 * $this->value - 0.76; $this->data['lovibond'] = $this->value; $this->data['ebc'] = (1.3546 * $this->value - 0.76) * 1.97; break; case 'ebc': $this->data['srm'] = $this->value * 0.508; $this->data['lovibond'] = ($this->value * 0.508 + 0.76) / 1.3546; $this->data['ebc'] = $this->value; break; } } } $color = new color(); $color->do_calculation(); $data = $color->data; $response = $color->response; $response['data'] = $data; echo json_encode($response);
<?php $codcolor = $_GET['c']; include_once "../../class/color.php"; $color = new color(); $col = $color->mostrarTodoRegistro(" codcolor='{$codcolor}'", 1, ""); $col = array_shift($col); $folder = "../../"; include_once $folder . "cabecerahtml.php"; include_once $folder . "cabecera.php"; ?> <section class=""> <div class="container"> <div class="row"> <h2 class="section-title">Modificar Diseño de Color </h2> <div class="col-sm-offset-3 col-sm-6"> <fieldset> <legend>Datos del Diseño</legend> <form action="actualizar.php" method="post" class="formulario"> <input type="hidden" name="codcolor" value="<?php echo $codcolor; ?> "> <table class="table table-bordered"> <tr> <td>Descripción</td> <td><input type="text" name="descripcion" class="form-control" value="<?php echo $col['descripcion']; ?> "></td> </tr>
function addBorderpng($im, $border = 1, $color = 'eee') { $width = imagesx($im); $height = imagesy($im); $img_adj_width = $width - 2 * $border; $img_adj_height = $height - 2 * $border; $newimage = imagecreatetruecolor($width, $height); $bg_color = new color(); $bg_color->set_hex($color); $background = imageColorAllocate($newimage, $bg_color->get_rgb('r'), $bg_color->get_rgb('g'), $bg_color->get_rgb('b')); imagefilledrectangle($newimage, 0, 0, $width, $height, $background); imagecopyresampled($newimage, $im, $border, $border, 0, 0, $img_adj_width, $img_adj_height, $width, $height); imagedestroy($im); return $newimage; }
<?php header("Content-Type:text/html;charset=UTF-8"); include "../../../system.php"; include "../../system.php"; include "../../../gd.php"; include "../../../function/new_function.php"; include "color_unit.php"; //System----------------------------------------------------------- $now_table = $pro_color_table; //System----------------------------------------------------------- $sam = new guard(); $unit = new color(); $name = trim($_POST['name']); //START DB Write In------------------------------------------------------------------- $sql = "select * from `{$now_table}` where `name`='{$name}'"; $res = mysql_query($sql); if (mysql_num_rows($res) == 0) { $unit->table = $now_table; $unit->name = $name; if (!empty($name)) { $unit->add(); } }
function setColor($color, $position = NULL) { if (!is_array($color)) { $color = array($color); } if (!isset($position)) { $color = array_reverse($color); } elseif (!is_array($position)) { $position = array($position); } while ($cl = current($color)) { $strcl = NULL; if ($cl[0] == "#") { $rgb = color::hex2rgb($cl); $strcl = "colore," . $rgb[0] . "," . $rgb[1] . "," . $rgb[2]; } elseif (strpos($cl, ",")) { $strcl = "colore," . $cl; } if ($strcl) { if (isset($position) && current($position) + 1) { $this->color[current($position)] = $strcl; } else { array_unshift($this->color, $strcl); } } next($position); next($color); } }
<?php require "color.php"; $str = "hello world"; $style = array(color::BOLD, color::UNDERLINED, color::DIM); echo color::green($str, $style) . "\n"; echo color::red($str, array(color::DIM)) . "\n"; echo color::cyan($str, array(color::UNDERLINED)) . "\n"; echo color::green($str) . "\n"; echo color::yellow($str) . "\n"; echo color::magenta($str) . "\n"; echo color::cyan($str) . "\n"; echo color::lightGray($str) . "\n"; echo color::darkGray($str) . "\n"; echo color::lightRed($str) . "\n"; echo color::lightGreen($str) . "\n"; echo color::lightBlue($str) . "\n"; echo color::lightMagenta($str) . "\n"; echo color::lightCyan($str) . "\n"; echo color::white($str) . "\n";
} $prop = round($width / $height, 2); $bg_color = "#000008"; if (array_key_exists('bg', $_GET)) { $bg_color = $_GET['bg']; } $background = new color(); $background->set_name($bg_color); if (!$background->get_hex()) { $background->set_hex($bg_color); } $fg_color = "#FFFFFF"; if (array_key_exists('fg', $_GET)) { $fg_color = $_GET['fg']; } $foreground = new color(); $foreground->set_name($fg_color); if (!$foreground->get_hex()) { $foreground->set_hex($fg_color); } $img_w = 0; $img_h = 0; $error_flag = False; $ini_array = parse_ini_file("../config.ini"); $dbhost = $ini_array['host']; $dbuser = $ini_array['user']; $dbpass = $ini_array['pass']; $dbname = $ini_array['dbname']; $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname); unset($ini_array, $dbhost, $dbuser, $dbpass, $dbname); if (!$mysqli) {
function splitColors($spl) { $expl = explode("^", $spl); $alldt = array(); if (count($expl) != 1) { $ind = 0; foreach ($expl as $key => $value) { if ($value != "") { $number = $value[0]; $replaced = str_replace($number, "", $value); if ($replaced != "") { $alldt[$ind]["text"] = $replaced; if ($this->hasColor($number)) { $alldt[$ind]["color"] = $number; $c = new color($number); $alldt[$ind]["hex"] = $c->getHex(); } else { $default = 1; $alldt[$ind]["color"] = $default; $c = new color($default); $alldt[$ind]["hex"] = $c->getHex(); } $ind++; } } } return $alldt; } else { return $spl; } }
<?php include_once "../../login/check.php"; $descripcion = $_POST['descripcion']; $precio = $_POST['precio']; include_once "../../class/color.php"; $color = new color(); $valores = array("descripcion" => "'{$descripcion}'", "precio" => "'{$precio}'"); $color->insertarRegistro($valores); $folder = "../../"; include_once $folder . "cabecerahtml.php"; include_once $folder . "cabecera.php"; ?> <section class=""> <div class="container"> <div class="row"> <h2 class="section-title">Mensaje de Confirmación</h2> <div class="col-sm-offset-3 col-sm-6"> <div class="panel panel-default"> <div class="panel-heading"></div> <div class="panel-body"> <h5>Su Diseño se Registro Correctamente</h5> </div> </div> </div> </div> </div> </section> <?php include_once $folder . "pie.php";
<?php include_once "../../login/check.php"; $descripcion = $_POST['descripcion']; $precio = $_POST['precio']; $codcolor = $_POST['codcolor']; include_once "../../class/color.php"; $color = new color(); $valores = array("descripcion" => "'{$descripcion}'", "precio" => "'{$precio}'"); $color->actualizarRegistro($valores, "codcolor=" . $codcolor); $folder = "../../"; include_once $folder . "cabecerahtml.php"; include_once $folder . "cabecera.php"; ?> <section class=""> <div class="container"> <div class="row"> <h2 class="section-title">Mensaje de Confirmación</h2> <div class="col-sm-offset-3 col-sm-6"> <div class="panel panel-default"> <div class="panel-heading"></div> <div class="panel-body"> <h5>Su Diseño se Registro Correctamente</h5> <a href="listar.php" class="btn btn-success">Listar Diseños</a> </div> </div> </div> </div> </div> </section>
<?php include_once "../../class/color.php"; $color = new color(); extract($_POST); $col = $color->mostrarTodoRegistro(" descripcion LIKE '{$descripcion}%'", 1, ""); ?> <table class="table table-bordered table-striped table-hover"> <thead> <tr><th width="50">Nº</th><th>Descripción</th><th>Precio</th<th></th></tr> </thead> <?php foreach ($col as $c) { $i++; ?> <tr> <td class="der"><?php echo $i; ?> </td> <td><?php echo $c['descripcion']; ?> </td> <td><?php echo $c['precio']; ?> </td> <td><a href="modificar.php?c=<?php echo $c['codcolor']; ?>