Collecting the coordinates data inside of an image on clickThe example below will display the values of the coordinate ( X and Y ) of the point you click.
Here is the code
Collecting the values of the coordinates of any image is a common requirement in many applications. For example if we have one map and wants the visitors to click on any area of the map to enlarge ( zoom ) it then we must know the coordinates of the click point where the visitor wants to be magnified.
Based on the coordinates in X and Y plot of the image we can further process the script to give desire result.
Here by using CSS, your mouse pointer is changed to cross. You can learn more on how to change the mouse pointer in our CSS section or click here.
Coordinates X YNote that the value of X ( horizontal ) and Y ( Vertical ) coordinate is zero at the top left corner of the image. It reaches its maximum value at the right bottom point of the image.
We can get the coordinates without reloading the page.
This article is written by plus2net.com team.
GD functions in PHP for handling images & graphicsHow to check GD support in PHP
Header for an image in browser
Drawing of graphic lines using GD
Plotting line graph by drawing data from table
Adding vertical grid to line graph
Adding rectangles using imagerectangle()
Imagearc drawing arc and circle
Imagefilledarc drawing filled arc and circle
Resizing and adding border to Images
Script for Watermarking image on the fly using PHP GD
Generate image by using user input form data