Просмотр поста

.
Screamer

откопал в просторах интернета.
Преобразование картинки в текст.

echo '<style>
 div#picture span {
       display: block;
       float: left;
       width: 5px;
       height: 5px;
    }
</style>';

$file = "pic.png";
$mSize = 100;
$im = imagecreatefrompng($file);
list($x, $y) = getimagesize($file);
$ratio = $x/$y;

if ($x > $y) 
{

    $nx = $mSize;
    $ny = round($mSize / $ratio);
	
} 
else 
{

    $ratio = 1/$ratio;
    $ny = $mSize;
    $nx = round($mSize / $ratio);
	
}

$message = '<div id="picture">';
$ni = imagecreatetruecolor($nx, $ny);
imagecopyresampled($ni, $im, 0, 0, 0, 0, $nx, $ny, $x, $y);

for($h = 0; $h < $ny; $h++) 
{

    $message .= '<div style="clear:both"></div>';
	
    for($w = 0; $w < ceil($nx); $w++) 
	{
	
       $rgb = imagecolorat($ni, $w, $h);
       $r = ($rgb >> 16) & 0xFF;
       $g = ($rgb >> 8) & 0xFF;
       $b = $rgb & 0xFF;
       $message .= sprintf('<span style="color: rgb(%d, %d, %d)">*</span>', $r, $g, $b);
	   
    }
}

$message .= '</div>';

echo $message;
Прикрепленные файлы: