//$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 );
$texture .= $char;
};
$texture .= "
";
};
return $texture;
};
//////////////
// //
// Poem //
// //
//////////////
function texturePoem( $imageFile, $poem = "", $xStep = 1, $yStep = 2 )
{
if( strlen( $poem ) )
{
//$poem .= "@@@@@";
$poem = strtoupper ( $poem );
$poem = str_replace( " ", "@", $poem );
$poem = str_replace( ",", "", $poem );
$poem = str_replace( ".", "@", $poem );
$poem = str_replace( """, '"', $poem );
};
$imageResource = ImageCreateFromJPEG( $imageFile );
$width = imagesx( $imageResource );
$height = imagesy( $imageResource );
$texture = "";
$i = 0;
for( $y = 0; $y < $height; $y += $yStep )
{
//$texture .= "\n\n";
$texture .= "\n\n";
for( $x = 0; $x < $width; $x += $xStep )
{
$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 .= "\n". $char ."
";
if( strlen( $poem ) )
{
$i++;
if( $i > strlen( $poem ) - 1 ) $i = 0;
};
};
//$texture .= "
";
//$texture .= "
";
$texture .= "\n
";
};
return $texture;
};
//////////////////
// //
// Document //
// //
//////////////////
echo "\n"; ?>
CULTURE IS A VIRUS