My problem is when you use for exemple :
<img src="/img.jpg" />
the src has to be an image and the image has to be accessible to the person. I want to be able to control the access to those image (if the user is logged for example). IF the person has not access to the image, he can’t access it. My script that controls the access to an image is a php file.
I know .htaccess can limit access to ressources, but I need to valid in the php file. Is there a way to do this or to load the image with javascript (using ajax request) and changing the source of the image to the location of the image in the temp folder?
Your image source doesn’t necessarily have to point to the real image, neither does it have to be an image:
Then you can write a PHP script which does the required validations and return the image afterwards through the script