You can't know really (I don't believe), how long they stay at a page because they can always close the window and you won't know. I suggest you create a database table with fields such as their IP Address, originally seen (datetime), and lastseen (datetime). Every time the user calls a picture from your PHP script, it will query the database to see if the IP Address ($_SERVER["REMOTE_ADDR"]) exists already in the database, if it doesn't it will insert a record, with their IP, MySQL NOW() for both datetimes. If the record does exists, you should update the lastseen.
Then you can create a script to find the differences for the IP Addresses. You should also be aware that many providers offer DHCP and people's computer's IP will change every so often.
You can't keep sessions or cookies with pictures I am pretty sure. Hope this will give you a start