Advertisement
Guest User

Untitled

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