<?php

#
# Purpose: translates ascii characters a-z to their braille symbol.
#

function ascii2braille($char) {
    
# Position coords (for reference)
    
$coords = array(
        
'top' => array(10103310),
        
'mid' => array(10333333),
        
'btm' => array(10563356)
    );

    
# The braille alphabet
    
$braille = array(
        
97 => array(1010),
        array(
10101033),
        array(
10103310),
        array(
101033103333),
        array(
10103333),
        array(
101033101033),
        array(
1010331010333333),
        array(
101010333333),
        array(
33101033),
        array(
331010333333),
        array(
10101056),
        array(
101010331056),
        array(
101033101056),
        array(
1010331033331056),
        array(
101033331056),
        array(
1010331010331056),
        array(
10103310103333331056),
        array(
1010103333331056),
        array(
331010331056),
        array(
3310103333331056),
        array(
101010563356),
        array(
1010105610333356),
        array(
3310103333333356),
        array(
1010331010563356),
        array(
10103310333310563356),
        array(
1010333310563356)
    );

    
# Create the resource
    
$image imagecreatetruecolor(4467);

    
# Define colors
    
$black imagecolorallocate($image000);
    
$white imagecolorallocate($image255255255);
    
    
# Set the background color
    
imagefill($image00$white);

    
$data $braille[ord($char)];
    for (
$i 0$n count($data); $i $n$i+=2) {
        
$x $data[$i];
        
$y $data[$i+1];
        
imagefilledellipse($image$x$y1515$black);
    }

    
# Display
    
header('Content-type: image/png'); 
    
imagepng($image);
    
imagedestroy($image);
}

# Calling example
ascii2braille('a');

?>