Guest User

Untitled

a guest
May 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1.     $imgw = imagesx($img);
  2.     $imgh = imagesy($img);
  3.     $ratio = $imgw/$imgh;
  4.     $newh = floor(sqrt(800 / $ratio));
  5.     $neww = floor($ratio * $newh);
  6.  
  7.     $newimg = imagecreatetruecolor($neww, $newh);
  8.     imagecopyresampled($newimg, $img, 0, 0, 0, 0, $neww, $newh, $imgw, $imgh);
  9.     imagedestroy($img);
  10.     $out = '<font size="1"><u>';
  11.     for($j = 0; $j < $newh; $j++) {
  12.       for ($i = 0; $i < $neww; $i++) {
  13.         $color = imagecolorat($newimg, $i, $j);
  14.         $out .= '<font color="#'.strtoupper(dechex($color)).'">███</font>';
  15.       }
  16.       $out .= "\n";
  17.     }
  18.     $out .= '</u></font>';
  19.     echo $out;
Add Comment
Please, Sign In to add comment