Given the fact that pictures are shown on the pages with pagination. I.e. let's say on the 1st page of 10 posts with a preview picture, the second is also 10, and so on. How to read display images and then to write to the database? Click like clear, click it and Africa click.
If you're interested why, I'll tell you for example there is a post with 20 pictures. Need to calculate the rating of each image(ratio of impressions\clicks), and the highest rated stand as the main and most interesting. For example make 1,000 impressions for every photo post, then put the clickable as thumbnails.
I hope it is clear explained.