Jump to content

Pixle location of Image when Clicked


onlyican

Recommended Posts

hahahaha, this is gonna be fun I think

Going to
http://onlyican.com/images.php
You will see an image
and if you play with the form at the bottom, u see that depending what you select, it makes a box turn black

This is using GD LIB
The orig image (green with the yellow stripes) is one image
THe black box is another image

What I am looking for, is if someone clicks on that image, for me to find out the image pixle location of where they clicked

I dont want the geographical location of the click (where 0,0 is the top left of the screen)
I need it to be the image location
(where 0,0 is the top left corner of the image)

I think this is client side scripts (Javascript), as I dont think it can be done in server side scripting(php)

By the way, You may have guessed. I am using php
Link to comment
https://forums.phpfreaks.com/topic/18645-pixle-location-of-image-when-clicked/
Share on other sites

If you use the image itself as a submit 'button', then php will pass the x and y co-ordinates (relative to the upper left corner of the image) of where it was clicked as the 'name' values of the submit button, i.e. $_POST['submit_x'] and $_POST['submit_y']

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.