Advertisement
Guest User

Untitled

a guest
Jan 17th, 2014
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.29 KB | None | 0 0
  1. <?php
  2. ini_set('memory_limit', '-1');
  3. ini_set('max_execution_time', 300);
  4.  
  5. $file = file_get_contents('compressed.log');
  6. $lines = explode("\n", $file);
  7.  
  8. $from = 0;
  9. $count = count($lines)-2;
  10.  
  11. $width = 8639;
  12. $height = $count;
  13.  
  14. $image = imagecreatetruecolor($width, $height);
  15. $color['0'] = imagecolorallocate($image, 255, 255, 255);
  16. $color['1'] = imagecolorallocate($image, 238, 238, 238);
  17. $color['2'] = imagecolorallocate($image, 229, 229, 229);
  18. $color['3'] = imagecolorallocate($image, 221, 221, 221);
  19. $color['4'] = imagecolorallocate($image, 212, 212, 212);
  20. $color['5'] = imagecolorallocate($image, 204, 204, 204);
  21. $color['6'] = imagecolorallocate($image, 195, 195, 195);
  22. $color['7'] = imagecolorallocate($image, 187, 187, 187);
  23. $color['8'] = imagecolorallocate($image, 178, 178, 178);
  24. $color['9'] = imagecolorallocate($image, 170, 170, 170);
  25. $color['a'] = imagecolorallocate($image, 161, 161, 161);
  26. $color['b'] = imagecolorallocate($image, 153, 153, 153);
  27. $color['c'] = imagecolorallocate($image, 144, 144, 144);
  28. $color['d'] = imagecolorallocate($image, 136, 136, 136);
  29. $color['e'] = imagecolorallocate($image, 127, 127, 127);
  30. $color['f'] = imagecolorallocate($image, 118, 118, 118);
  31. $color['g'] = imagecolorallocate($image, 110, 110, 110);
  32. $color['h'] = imagecolorallocate($image, 101, 101, 101);
  33. $color['i'] = imagecolorallocate($image, 93, 93, 93);
  34. $color['j'] = imagecolorallocate($image, 84, 84, 84);
  35. $color['k'] = imagecolorallocate($image, 76, 76, 76);
  36. $color['l'] = imagecolorallocate($image, 67, 67, 67);
  37. $color['m'] = imagecolorallocate($image, 59, 59, 59);
  38. $color['n'] = imagecolorallocate($image, 50, 50, 50);
  39. $color['o'] = imagecolorallocate($image, 42, 42, 42);
  40. $color['p'] = imagecolorallocate($image, 33, 33, 33);
  41. $color['q'] = imagecolorallocate($image, 25, 25, 25);
  42. $color['r'] = imagecolorallocate($image, 16, 16, 16);
  43. $color['s'] = imagecolorallocate($image, 8, 8, 8);
  44. $color['t'] = imagecolorallocate($image, 0, 0, 0);
  45.  
  46.  
  47. $h = 0;
  48. foreach ($lines AS $key=>$line)
  49. {
  50.    
  51.     if($key > $from-1 AND $key<$from+$count)
  52.     {
  53.         $h++; //height up
  54.         for($w=0;$w<$width+1;$w++)
  55.         {
  56.             //echo $w.'-'.$h.'-'.$line[$w].'<br>';
  57.             imagesetpixel($image, $w, $h-1, $color[$line[$w]]);
  58.         }
  59.     }
  60. }
  61.  
  62.  
  63.     header("Content-type: image/png");
  64.     imagepng($image);
  65.     imagedestroy($image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement