image2html.php 514 B

1234567891011121314151617181920212223
  1. <?php
  2. require_once 'bootstrap.php';
  3. //$pixelCraft = new PixelCraft();
  4. $pixelCraft->loadImage('../assets/globe.jpg');
  5. $pixelCraft->pixelate(3,true);
  6. $pixelCraft->resize(32, 32);
  7. $map = $pixelCraft->getColorMap(false);
  8. $result = '';
  9. foreach ($map as $x => $ys) {
  10. foreach ($ys as $y => $color) {
  11. $hex = $pixelCraft->rgbToHex($color);
  12. $result .= '<font style="font-weight: bold;" color="' . $hex . '">@</font>'.PHP_EOL;
  13. }
  14. $result .= '<br>';
  15. }
  16. print('<small>' . $result . '</small>');