i have made an application to convert text into image and it working out fine,now i am using JSON for conversion,it also working but except only two fields.....why i dont know, my codes are given below...please help me , is there any better way?
//
img.html
     
    excoflare
enter your text here:
    
    
        Font Size:         
        
    
     Color:               
    Font:                 
    
    
        Height:             
        
    
    Width:              
    
    
                                 
img.php
    require_once 'JSON/JSON.php';
    header('Content-type: application/json');
    header ("Content-type: image/png");
    $text =$_REQUEST['text'];
    $text=json_encode($text);
    $path="C:\wamp\www\image";
    $height=$_REQUEST['height'];
    $width=$_REQUEST['width'];
    define("WIDTH", $width);
    json_encode(WIDTH);
    define("HEIGHT",  $height);
    json_encode(HEIGHT);
    $img = imagecreate(WIDTH, HEIGHT);
    imagesavealpha($img, true);
    $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127);
    imagefill($img, 0, 0, $trans_colour);
    $getcolor=$_REQUEST['color'];
    switch($getcolor) {
            case 'red':
        $red = imagecolorallocate($img, 223, 14, 91);
                    $color=json_encode($red);
                    break;
    case 'white':
         $white = imagecolorallocate($img, 255, 255, 255);
                     $color=json_encode($white);
        break;
    case 'black':
         $black = imagecolorallocate($img, 0,0,0);
                     $color=json_encode($black);
        break;
    case 'grey':
        $grey = imagecolorallocate($img, 128, 128, 128);
                    $color=json_encode($grey);
        break;
           // default:
    //  break;
}
    //$background_color = imagecolorallocate ($img, 25, 25, 25);
    $font = $_REQUEST['font'];
    //$font=json_encode($font);
    $fontsize =$_REQUEST['size'];
    //$fontsize=json_encode($fontsize);
    imagettftext($img, $fontsize, 0, 20, 20, $color, $font, $text);
    //Create image
    imagepng($img);
    imagepng($img,"$path/img.png");
    //destroy image
    ImageDestroy($img);
    //header ('Content-type: image/png');
?
Thanks in advance..