dynamic image manipulation

From: Date: Fri, 13 Oct 2000 11:12:30 +0000
Subject: dynamic image manipulation
Groups: php.general 
Request: Send a blank email to php-general+get-19988@lists.php.net to get a copy of this message
I have a similar file as button.php, but it creates an empty 800x500 image. Now, I have two frames (top_frame, and bot_frame) on my main window. The topframe's source is a PHP file and ditto with the bottom frame. I'm using javascript(side question: can javascript also dynamically manipulate/draw graphics?) to create a series of random values and then I want them to be plotted (in real time) to the empty image; thus, creating a graph. So far, my botframe.php is as follows: <? $x = getenv("QUERY_STRING"); parse_str($x); header("Content-type: image/png"); $im = ImageCreate(800,500); $black = ImageColorAllocate($im,0,0,0); $white = ImageColorAllocate($im,255,255,255); ImageLine($im,$x0,$y0,$x1,$y1,$black); ImagePNG($im); ?> The topframe.php is like this: *excerpt from javascript* <html> <head> <script language="javascript"> function drawpoint(){ var k,i,prev; k = 0; for (i=1;i < 800;i++){ prev = k; k = Math.random(1,20); i = i+1; top.document.image.src = "imagecr.php?x0="+(i-1)+"&y0="+prev+"&x1="+i+"&y1="+k; } } </script> </head> <body onload=drawpoint()> </body> </html> Then in the top.document.image... line, it will take the created image and overlay it with line plots(from (x0,y0) to (x1,y1)). As it stands, it does nothing of the sort, in fact, it just gives me a blank page. Can someone please tell me what I'm doing wrong, or rather, how I should go about in doing this? Any help appreciated.

« previous php.general (#19988) next »