Not sure how you mean "loaded", if you mean in the page, then it's probably best to use JavaScript. PHP is server side and processed before the DOM (the html part) is even loaded.
In Javascript you'd need to get all the images with a certain class that you want to check, or you could check id's to see which is on the page, if all are on the page you could check their css to see if the "display" property is set, and if it is you then know which one is loaded and shown.
I wont spoonfeed you the code because it's good to learn, and when you get it working you will feel very proud.
I suggest learning a little bit of jQuery, a little bit of JavaScript, and some HTML. PHP is mainly used for lots of data stuff like storing and meddling with values, whereas JS is more a make stuff move and see what's there kinda language (: