Jump to content


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


Pixle location of Image when Clicked

Recommended Posts

hahahaha, this is gonna be fun I think

Going to
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

Share this post

Link to post
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']

Share this post

Link to post
Share on other sites


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.