I want to know uploaded images only a images its not have any type of hidden embedded data like other images or any IP address Thanks
Asked
Active
Viewed 2,167 times
-1
-
use jquery and add an event such that when the image is clicked make a get request. I Was going to mark this as a duplicate but it is a little different in totality. just refer this answer on how to get an ip adress. https://stackoverflow.com/a/35123097/8417000 – Rishabh Kandari Sep 04 '17 at 17:00
-
want to make a image and send this image in email,whatsapp and facebook after that if any one open this image get the ip address that one – Priyanka Sankhala Sep 04 '17 at 17:04
-
It looks like you are trying to create some kind of mass ip catcher. Images are binary data that do not hold connections to servers.. You will have to create a link that will have to have a featured image and share its link, so that when someone clicks on that link their ip gets logged. This is how you may want to do it.. But sharing of raw images is just not going to work. – Rishabh Kandari Sep 04 '17 at 17:07
1 Answers
1
You can use the image as a button and call a JavaScript function. This function will need to call an API that will return the data you want.
<img onclick="javascript:getIPData()" src="China-Flag-256.png" />
<script>
function getIPData() {
var request = new XMLHttpRequest();
request.open('GET', 'http://freegeoip.net/json/', true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
// Success!
var data = JSON.parse(request.responseText);
} else {
// We reached the service, but it returned an error
}
};
request.onerror = function() {
// Deal with connection error here
};
request.send();
}
</script>
will return:
{
"ip": "116.12.250.1",
"country_code": "SG",
"country_name": "Singapore",
"region_code": "01",
"region_name": "Central Singapore Community Development Council",
"city": "Singapore",
"zip_code": "",
"time_zone": "Asia/Singapore",
"latitude": 1.2931,
"longitude": 103.8558,
"metro_code": 0
}
You can check more services to request the IP from this other question How to get client's IP address using JavaScript only?

Pedro Henrique
- 601
- 6
- 17
-
Read my question Not do with jquery and any server side language – Priyanka Sankhala Sep 04 '17 at 17:18
-
No problem removed JQuery. I just don't know any way of doing this without a third party API. – Pedro Henrique Sep 05 '17 at 03:16
-
1Just noticed, you mention PHP on your question, which is a server side language. – Pedro Henrique Sep 05 '17 at 03:22