Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $imgw = imagesx($img);
- $imgh = imagesy($img);
- $ratio = $imgw/$imgh;
- $newh = floor(sqrt(800 / $ratio));
- $neww = floor($ratio * $newh);
- $newimg = imagecreatetruecolor($neww, $newh);
- imagecopyresampled($newimg, $img, 0, 0, 0, 0, $neww, $newh, $imgw, $imgh);
- imagedestroy($img);
- $out = '<font size="1"><u>';
- for($j = 0; $j < $newh; $j++) {
- for ($i = 0; $i < $neww; $i++) {
- $color = imagecolorat($newimg, $i, $j);
- $out .= '<font color="#'.strtoupper(dechex($color)).'">███</font>';
- }
- $out .= "\n";
- }
- $out .= '</u></font>';
- echo $out;
Add Comment
Please, Sign In to add comment