/************************************************
** Image to ASCII
**
** Author.: leapinglangoor [ leapinglangoor@yahoo.co.in ]
** Date...: 12th Dec 2004
** ver....: v1.00
**
** desc...: Send an argument $filename and $dir
** The image can be png, jpeg or gif only.
** Use filename such as some.jpeg, langoors.gif, xhtml.png
** $dir - The path of the directory where the image is located
**
************************************************/
// if it really read each pixel, it'd be too slow and heavy. so, here we determine
// how many pixels the script must 'jump' each loop. tip: y jump must be greater
// than the x jump, to decrease the distorcion.
$x_jump = 2;
$y_jump = 3;
// char/strings that will construct the image. it's randomly selected after,
// in the loop. a value in the array will be one pixel in the asci-image.
$pixel_char = array(0);
echo "The image is $x_size x $y_size\n";
echo "<span style='font-size:6px; font-weight:bold;'>";
echo "<pre>";
// now it has a 'nested loop' to read 'each' pixel and print it
for( $y = 0; $y < $y_size; $y+=$y_jump )
{