Imagemagick does not work with ajax ..

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Posts: 28
Joined: 2011-11-28T08:11:59-07:00
Authentication code: 8675308

Imagemagick does not work with ajax ..

Post by sriducati »

Hello People,

Below is my front end code ..

Code: Select all

<html xmlns="">
<script src="//"></script>
<Script type="text/javascript">
    function im()
        var Name=document.getElementById("Name").value;
        var pointsize=document.getElementById("pointsize").value;
        var format=document.getElementById("format").value;
        var bckclr=document.getElementById("bckclr").value;
        var color=document.getElementById("color").value;
        var bcolor=document.getElementById("bcolor").value;
            var url='Name='+Name+'&pointsize='+pointsize+'&format='+format+'&bckclr='+bckclr+'&color='+color+'&bcolor='+bcolor;
            //-----Sending request to server for getting job name list by ajax-----
                type    : "POST",
                url     : "i.php?",
                data    : url,              
                cache   : false,
                success : function(html)
                    var pic='<img src="'+html+'">';
echo('Name: <input type="text" id="Name" onchange="im()" value="your name"  name="Name" />');
echo('pointsize: <input type="text" id="pointsize" onchange="im()" value="50" name="pointsize" />');
echo('format: <input type="text" id="format" value=".gif" onchange="im()" name="format" />');
echo('BackGround Color: <input type="text" id="bckclr" value="red" onchange="im()" name="bckclr" />');
echo('FontColor: <input type="text" id="color" value="white" onchange="im()" name="color" />');
echo('Border Color: <input type="text" id="bcolor" value="blue" onchange="im()" name="bcolor" />');

echo ('<div id="Div_Im">');
echo('replace me');
echo ('</div>');
and backend code is:

Code: Select all

$filename = $Name.$format;

$cmd = " -background $bckclr -pointsize $pointsize -font $font -fill $color ".
            " -strokewidth 1 -stroke $bcolor label:\"$Name\" ";

exec("convert $cmd $filename");
echo('<img src="'.$filename.'">');
//echo $filename;
above code works only if i made changes to Name field but it does not work for any other parameters,we should keep refreshing the image to get an output image.... how do we fix this???