呵呵,麻烦,我还是说思想用一个对象,记录线条的起始结束坐标。
最后post给PHP,由PHP根据这些坐标,画一份一样的图,
header给客户端嗯

解决方案 »

  1.   

    估计100RMB对于高手来说,都懒得动手
      

  2.   

    个人认为不需要保存成什么jpg文件吧,你如果只需要保存这个效果,直接document.getElementById("map").innerHTML得到map里的标记,保存到数据库,显示的时候,取出来放到你map标记里显示就可以了.如果实在要保存成jpg,其实也可以
    主要通过<v:Line id='line_"+fromX+"_"+fromY+"_"+toX+"_"+toY+"' from='" + fromX + "," + fromY + "' to='" + toX + "," + toY + "' strokecolor='red'></v:Line>这个标记的特点,用点js加一个简单的php函数就OK了.要实现是完全没有问题,可是现在我没有时间去写代码,有时间写出来了,就发上来.
    钱就不必了,这里多是相互帮助的地方.
      

  3.   

    <SCRIPT LANGUAGE="JavaScript"> 
    var x,y,a,b,i = 0;  
    function drawline(fromX,fromY,toX,toY)
    {   
        var strElement=   "<v:Line id='line_"+fromX+"_"+fromY+"_"+toX+"_"+toY+"' from='" + fromX + "," + fromY + "' to='" + toX + "," + toY + "' strokecolor='red'></v:Line>";   
        var newPoint = document.createElement(strElement);   
        document.getElementById("map").appendChild(newPoint);     
    }
    function draw()
    {
        i++;
        if(i%2==1)
        {
            x=window.event.x;y=window.event.y;return false;
        }
        a=window.event.x;b=window.event.y;
        drawline(x,y,a,b);
        x=a;y=b;    
    }
    function draws()
    {
        if(i%2==1)
        {
            if(x==undefined&&b==undefined){return false;}
            if(x==window.event.x&&b==window.event.y){return false;}
            if(document.getElementById("TempLine")){document.getElementById("TempLine").outerHTML=""}
            var strElement=   "<v:Line id='TempLine' from='" + x + "," + y + "' to='" + window.event.x + "," + window.event.y + "' strokecolor='red'></v:Line>";  
            var newPoint = document.createElement(strElement);  }  
            document.getElementById("map").appendChild(newPoint);     
    }
    function savemap(){
    var mapobj=document.getElementById("map");
    var nodes=mapobj.childNodes;
    var nodesNum = nodes.length;
    var cobj,_from,_to,re;
    var LineString="";
    for(var i=nodesNum-1;i>=0;i--) { 
    cobj=nodes[i];
    if(cobj.id!="TempLine"){
    _from=cobj.from+"";
    _to=cobj.to+"";
    re = /pt/g;
    _from=_from.replace(re,"");
    _to=_to.replace(re,"");
    LineString=LineString+_from+"&"+_to+"|";
    }
    }
    mapobj.innerHTML=LineString;
    //将LineString通过ajax方式提交到php页面.并根据返回结果进行提示.
    //ajax的代码就不写了哈,都是晓得的
    }
    </SCRIPT>
    <html xmlns:v="urn:schemas-microsoft-com:vml">   
    <HEAD>   
    <META http-equiv="Content-Type" content="text/html;Charset=gb2312">   
    <title>vml实例</title>   
    <STYLE>   
    v\:*{behavior:url(#default#VML);}/*声明V为VML变量*/   
    </STYLE>   
    </HEAD>   
    <BODY>
    <table border="1" align="center">
        <tr>
            <td><div id="map" style="width:600px;height:500px;background-color:#cccccc;position:relative;" onmousedown="draw();" onmousemove="draws();"></div>
            </td>
        </tr>
    </table>
    <p align="center">
      <input type="button" name="Submit" value="保存图象" onClick="return savemap();">
    </p>
    </body>   
    </html> 
      

  4.   

    <?php
    header("Content-type: image/jpeg");
    $IM = imagecreate (600,500);
    $White = imagecolorallocate($IM,0xf5,0xf5,0xf5);
    $Red = imagecolorallocate($IM,0xff,0x00,0x00);
    //$LineString=$_GET["LineString"];
    //$LineString=$_POST["LineString"];
    $LineString="318,135&327,263.25|148.5,263.25&327,262.5|318.75,137.25&148.5,263.25|139.5,137.25&148.5,262.5|138.75,136.5&318,135.75|";//例子
    $LineArray=explode("|",$LineString);
    foreach($LineArray as $LineData){
    $LineChild=explode("&",$LineData);
    if(count($LineChild)==2){
    $LineStart=explode(",",$LineChild[0]);
    $LineEnd=explode(",",$LineChild[1]);
    imageline($IM,$LineStart[0],$LineStart[1],$LineEnd[0],$LineEnd[1],$Red);
    }
    }
    imagejpeg($IM);
    //imagejpeg($IM,"test.jpg",80);//保存图片.80为图片质量
    //推荐用ImagePNG()输出,这样图片质量要好些,文件大小也小些
    ?>
      

  5.   

    html里的 mapobj.innerHTML=LineString;
    这句是测试用的.主要是得到$LineString的值,用于在php里测试.
    给分吧.