Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
12-03-2010, 07:26 AM #1
- Join Date
- Dec 2010
- Thanked 0 Times in 0 Posts
Unable to Update GD Image Within A Webpage
I am having trouble updating/refreshing an image that I have created in GD. I have created a GD image (draw.php) and another php file to display this image as part of a webpage. Then based on where a user clicks on the initial image, I am using the POST action to capture the coordinates (using input type=image) and want to draw a circle at that location.
<?php header ("Content-type: image/jpeg"); $xx1=$_POST['ice_x']; $yy1=$_POST['ice_y']; ...............................creating the Image here // Drawing circle based on user coordinates ImageFilledArc($im,$xx1,$yy1,25,25,0,360,$text_color,IMG_ARC_PIE); ImageJpeg ($im); imagedestroy($im); ?>
12-03-2010, 04:31 PM #2
- Join Date
- Jun 2003
- Cottage Grove, Minnesota
- Thanked 1,095 Times in 1,086 Posts
This was the best I could come up with.
It uses the built-in coordinates from a <form> image control.
Here is my test page:
EDIT: I switched from SESSION to cookies.
The only problem I see now, it an occasional submit message
until the image is cached.
This is the index.php script:
This is the draw.php script:PHP Code:
<form action="position.php" method="POST">
<input type="image" src="draw.php?xx=<?=$_COOKIE['xx1']?>&yy=<?=$_COOKIE['yy1']?>" name="ice" />
header ("Content-type: image/jpeg");
$im = imagecreatefromjpeg($filename);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
// Drawing circle based on user coordinates
This is the "position.php" script that makes the cookie ...
It takes care of the extra header needed.
header ("location: index.php");
Last edited by mlseim; 12-03-2010 at 07:21 PM.
Users who have thanked mlseim for this post: