HELP API Output to JPEG Using PHP and GD

[size=1]Ok, i got the source from Jerry Jasuta to build a Drawing API, everything works perfectly it draws and saves the images into jpg. I have a little problem, how do i make it load images to the same file, I want to be able to load pictures and draw on them then save them into jpg.[/size]

[size=1]Need help …Please…[/size]

[size=1]Actionscripting in the frame,[/size]

drawing=false;
data=’’;

createEmptyMovieClip(’_keyListener’,1);
Key.addListener(_keyListener);
_keyListener.onKeyDown=function(){
clear();
_root.data=’’;
};

with(_root)

onMouseDown=function(){
drawing=true;
startX=_xmouse;
startY=_ymouse;
moveTo(startX,startY);
};
onMouseUp=function(){
drawing=false;
};
onMouseMove=function(){
if(drawing==true){
lineStyle(2);
lineTo(_xmouse,_ymouse);

if(drawing==true && _ymouse<200){
lineStyle(2);
lineTo(_xmouse,ymouse);
root.data+=startX+’’+startY+’
’+xmouse+’’+_ymouse+’-’;
startX=_xmouse;
startY=_ymouse;
}
updateAfterEvent();
};
}

[color=red]This makes the PHP Part work,[/color]

$data=$HTTP_POST_VARS[“data”];

$image=imagecreatetruecolor(300,200);
$imagelines=imagecreate(300,200);

$background=imagecolorallocate($imagelines,255,255,255);
$linecolor=imagecolorallocate($imagelines,0,0,0);

$lines=explode("-",$data);

for($l=0;$l<count($lines)-1;$l++){

$lineData=explode("_",$lines[$l]);

imageline($imagelines,$lineData[0],$lineData[1],$lineData[2],$lineData[3],$linecolor);
}

imagecopyresampled($image,$imagelines,0,0,0,0,300,200,300,200);

imagejpeg($image,“created.jpg”);

imagedestroy($image);
imagedestroy($imagelines);

print "<html>
<head>
<title></title>
</head>
<body bgColor=‘cccccc’>
<center>
<p>
<img src=‘created.jpg’>
</center>
</body>
</html>

could you post a link to the site you got the (tutorial or file) from? i can find ming but cant really find the swf to jpeg part… You need to take a look at the tutorials about loading images and using php with flash(get/post).
Basicly you want the php part to echo a var (name of the image for example) to the swf, instead of the “print html”. The swf gets the var and loads it in a target (empty movieclip) which is behind the drawing part… then it starts all over again.

Here’s the samples I’ve posted for converting the MX drawing API to JPEG/PNG/SWF using PHP/Ming/GD
http://jerryscript.hostrocket.com/flash/draw/SWFDrawing2JPEG.html

To use the drawing API over an image, you must pass the URL of the image to the PHP conversion script, then use imagecopyresampled to composite the drawing image over the loaded image.

I will try to find the time to post a good example, but time is an issue for me currently. Attached is one method, but I’m not really happy with it, so I plan to do quite a bit of rewriting before adding it to the main examples.