$value = "@#" . "$" . "MN0eDEABOPQRdgtu?]STz():;,.!_\~/-'` "; // < > $value = "0WESDT1!;:. "; $value = "WESRAT!;:. "; $value = "WESRAT "; for ($y = 0; $y < $height; $y++) { $texture .= "\n\n"; for ($x = 0; $x < $width; $x++) { $rgb = imageColorsForIndex($imageResource, imageColorAt($imageResource, $x, $y)); $w = $rgb["red"] + $rgb["green"] + $rgb["blue"]; $wPercent = floor((($w) / (256 * 3)) * 100); $char = $value[floor($wPercent * (strlen($value) / 100))]; //$char = $value[strlen($value) - (floor($wPercent * (strlen($value) / 100))) - 1]; $char = str_replace(" ", " ", $char); $hexval = sprintf("%02X%02X%02X", $rgb["red"], $rgb["green"], $rgb["blue"]); //$texture .= "". $char .""; $texture .= $char; } $texture .= "
"; } return $texture; } ////////////// // POETRY // ////////////// function texturePoem($imageFile, $poem) { if (strlen($poem)) { $poem .= "@@@@@"; // Trailer $poem = strtoupper($poem); // Majiscules $poem = str_replace(" ", "&", $poem); // Spaces $poem = str_replace(",", "", $poem); // Commas $poem = str_replace(".", "%", $poem); // Periods $poem = str_replace(""", '"', $poem); // Quotes } $imageResource = ImageCreateFromJPEG($imageFile); $width = imagesx($imageResource); $height = imagesy($imageResource); $texture = ""; $i = 0; for ($y = 0; $y < $height; $y++) { $texture .= "\n\n"; for ($x = 0; $x < $width; $x++) { $rgb = imageColorsForIndex($imageResource, imageColorAt($imageResource, $x, $y)); $w = $rgb["red"] + $rgb["green"] + $rgb["blue"]; $wPercent = (($w) / (256 * 3)) * 100; $factor = strlen($value) / 100; if (strlen($poem)) { $char = str_replace(" ", " ", $poem[$i]); } else { $char = (rand() % 2); } $hexval = sprintf("%02X%02X%02X", $rgb["red"], $rgb["green"], $rgb["blue"]); $texture .= "". $char .""; if (strlen($poem)) { $i++; if ($i > strlen($poem)) $i = 0; } } $texture .= "
"; } return $texture; } echo textureGradient("MEDIA/52R7.jpg"); //echo texturePoem("MEDIA/01.jpg", ""); require_once("GLOBAL/foot.php"); ?>