Is there a way to run code when an image is loaded?
For example when if my image is hosted at www.mydomain.com/image.png and if someone executes this link image will be displayed as this is an image file. But, can I run a set of code when someone trying to view an image?
Like.
When I open run www.mydomain.com/image.png it should perform something like
<?php
mail("myemail@mydomain.com", "image opened", "image opened by".$Server['addr']);
?>
I found there are multiple such services offered online but I am unable to sort out how to execute a code file when image file is trying to be executed.
Can anyone give me a brief idea how this will workout? I can code on my own a