Source for file Hiero.php
Documentation is available at Hiero.php 
 * ----------------------------------------------------------------------  
 * Copyright (c) 2006-2016 Khaled Al-Sham'aa.  
 * ----------------------------------------------------------------------  
 * This program is open source product; you can redistribute it and/or  
 * modify it under the terms of the GNU Lesser General Public License (LGPL)  
 * as published by the Free Software Foundation; either version 3  
 * of the License, or (at your option) any later version.  
 * This program is distributed in the hope that it will be useful,  
 * but WITHOUT ANY WARRANTY; without even the implied warranty of  
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 * GNU Lesser General Public License for more details.  
 * You should have received a copy of the GNU Lesser General Public License  
 * along with this program.  If not, see <http://www.gnu.org/licenses/lgpl.txt>.  
 * ----------------------------------------------------------------------  
 * Class Name: Translate English word into Hieroglyphics  
 * Original    Author(s): Khaled Al-Sham'aa <khaled@ar-php.org>  
 * Purpose:    Translate English word into Hieroglyphics  
 * ----------------------------------------------------------------------  
 * Translate English word into Hieroglyphics  
 * Royality is made affordable, and within your reach. Now you can have The  
 * Royal Cartouche custome made in Egypt in 18 Kt. Gold with your name  
 * translated and inscribed in Hieroglyphic.  
 * Originally, the Cartouche was worn only by the Pharaohs or Kings of Egypt.  
 * The Pharaoh was considered a living God and his Cartouche was his insignia.  
 * The "Magical Oval" in which the Pharaoh's first name was written was intended  
 * to protect him from evil spirits both while he lived and in the afterworld  
 * Over the past 5000 years the Cartouche has become a universal symbol of long  
 * life, good luck and protection from any evil.  
 * Now you can acquire this ancient pendent handmade in Egypt from pure 18 Karat  
 * Egyptian gold with your name spelled out in the same way as King Tut, Ramses,  
 *     include('./I18N/Arabic.php');  
 *     $obj = new I18N_Arabic('Hiero');  
 *     $im   = $obj->str2hiero($word);  
 *     header ("Content-type: image/jpeg");  
 *     imagejpeg($im, '', 80);  
 * @author    Khaled Al-Sham'aa <khaled@ar-php.org>  
 * @copyright 2006-2016 Khaled Al-Sham'aa  
 * @license   LGPL <http://www.gnu.org/licenses/lgpl.txt>  
 * @link      http://www.ar-php.org  
 * Translate English word into Hieroglyphics  
 * @author    Khaled Al-Sham'aa <khaled@ar-php.org>  
 * @copyright 2006-2016 Khaled Al-Sham'aa  
 * @license   LGPL <http://www.gnu.org/licenses/lgpl.txt>  
 * @link      http://www.ar-php.org  
    private $_language =  'Hiero';  
     * Loads initialize values  
    public function __construct ()  
     * Set the output language  
     * @param string $value Output language (Hiero or Phoenician)  
     * @return object $this to build a fluent interface  
     * @author Khaled Al-Sham'aa <khaled@ar-php.org>  
        if ($value ==  'hiero' ||  $value ==  'phoenician') {  
            $this->_language =  $value;  
     * Get the output language  
     * @return string return current setting of the output language  
     * @author Khaled Al-Sham'aa <khaled@ar-php.org>  
    * Translate Arabic or English word into Hieroglyphics  
    * @param string  $word  Arabic or English word  
    * @param string  $dir   Writing direction [ltr, rtl, ttd, dtt] (default ltr)  
    * @param string  $lang  Input language [en, ar] (default en)  
    * @param integer $red   Value of background red component (default is null)  
    * @param integer $green Value of background green component (default is null)  
    * @param integer $blue  Value of background blue component (default is null)  
    * @return resource Image resource identifier  
    * @author Khaled Al-Sham'aa <khaled@ar-php.org>  
        $word, $dir =  'ltr', $lang =  'en', $red =  null, $green =  null, $blue =  null  
        if ($this->_language ==  'phoenician') {  
        // Note: there is no theh, khah, thal, dad, zah, and ghain in Phoenician  
        if ($lang !=  'ar' &&  $this->_language ==  'phoenician') {  
            include dirname(__FILE__ ). '/Transliteration.php';  
            $temp =  new Transliteration();  
            $word =  $temp->en2ar($word);  
            $alef =  array('ى', 'ؤ', 'ئ', 'ء', 'آ', 'إ', 'أ');  
        for ($i =  0; $i <  $max; $i++ ) {  
        if ($dir ==  'rtl' ||  $dir ==  'btt') {  
        foreach ($chars as $char) {  
                list($width, $height) = getimagesize(  
                    dirname(__FILE__)."/images/{ $this->_language}/ $char.gif "  
            if ($dir == 'ltr' || $dir == 'rtl') {  
        $im = imagecreatetruecolor($max_w, $max_h);  
            $bck = imagecolorallocate($im, 0, 0, 255);  
            imagefill($im, 0, 0, $bck);  
            // Make the background transparent  
            imagecolortransparent($im, $bck);  
            $bck = imagecolorallocate($im, $red, $green, $blue);  
            imagefill($im, 0, 0, $bck);  
        foreach ($chars as $char) {  
            $filename = dirname(__FILE__)."/images/{ $this->_language}/ $char.gif ";  
            if ($dir == 'ltr' || $dir == 'rtl') {  
                if (file_exists($filename)) {  
                    list($width, $height) = getimagesize($filename);  
                    $image = imagecreatefromgif($filename);  
                        $im, $image, $current_x, $max_h - $height,   
                if (file_exists($filename)) {  
                    list($width, $height) = getimagesize($filename);  
                    $image = imagecreatefromgif($filename);  
                    imagecopy($im, $image, 0, $current_y, 0, 0, $width, $height);  
 
 
        
       |