jonaofarc Posted July 13, 2008 Share Posted July 13, 2008 I will pay anyone who can.... need X and Y cordinate of image that when user click image a text box opens in that spots and you can comment the image ..... I dont understand how to pass Javascript values into PHP anyways if anyone can help me get this done i will pay $20 via paypal. thanx! Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/ Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 What? Why do you need to pass the x and y to a PHP script? Some questions. Will the text box open above the image, where they clicked, or will it open below or to the side of the image? And is there more then 1 image on the page? Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/#findComment-588718 Share on other sites More sharing options...
jonaofarc Posted July 13, 2008 Author Share Posted July 13, 2008 I would like a text box (form) appear on the image wherver clicked , basically I want people to be able to comment a point on a picture Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/#findComment-588720 Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 I see, well you wouldn't need to use PHP as yet. You could just use javascript. Just pass the X and Y coordinates to hidden fields in the form with javascript, then you can post them to a PHP page. Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/#findComment-588728 Share on other sites More sharing options...
jonaofarc Posted July 13, 2008 Author Share Posted July 13, 2008 any ideas how to make a form appear on top of image when clicked on? Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/#findComment-588730 Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 Ask in the javascript forum, because I have no clue. That's a bit more advanced javascript then what I could do. This might help: http://www.emanueleferonato.com/2006/09/02/click-image-and-get-coordinates-with-javascript/ Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/#findComment-588735 Share on other sites More sharing options...
jonaofarc Posted July 13, 2008 Author Share Posted July 13, 2008 thanks for your help.... do you have paypal? Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/#findComment-588738 Share on other sites More sharing options...
Barand Posted July 13, 2008 Share Posted July 13, 2008 this should get you started <?php if (isset($_GET['myimage_x'])) { $imageX = $_GET['myimage_x'] ; // if you click on a form image it sends the coords of the click $imageY = $_GET['myimage_y'] ; } else $imageX = $imageY = -1; echo '<pre>', print_r($_GET, true), '</pre>'; ?> <html> <head> <meta name="generator" content="PhpED Version 4.5 (Build 4513)"> <title>Sample Image Comment</title> <meta name="author" content="Barand"> <link rel="shortcut icon" href=""> <script type='text/javascript'> var clickX = <?php echo $imageX ?>; // store PHP vars in JS script var clickY = <?php echo $imageY ?>; function placeComment() { if (clickX == -1) return; var pic = document.getElementById("myimage"); var box = document.getElementById("comment"); var ix = pic.offsetLeft; var iy = pic.offsetTop; box.style.position = "absolute"; box.style.top = iy+clickY; // calc position in page box.style.left = ix+clickX; } </script> </head> <body onload = "placeComment()"> <form> <input type='image' name='myimage' id='myimage' src='../baaWelcome.gif' border='0' width='596' height='52' ><br/> <input type='text' name='comment' id='comment' value='Your comment' size='40' style='zIndex: 1'> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/114487-i-will-pay-anyone-who-can-need-x-and-y-cordinate-of-image/#findComment-588839 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.