Starting here, we kind of wondered how the chat selects the preview picture. But with this, we changed our direction: where does the chat get these pictures from? The displayed pyramids picture is nowhere to be seen on the page itself (unless I overlooked something)!
It just picks the largest (to be precise, tallest) image on the page as returned by Wikipedia's API – and that particular image, even if only displayed as a tiny thumbnail, has a height of 2906 pixels.
In most cases, the largest image is a good representation of the Wikipedia article (I tested a lot); in this case, it's so-so. I've seen worse, though: The image for the Wolfgang Petry article is a picture of Johann Sebastian Bach – but you probably have to be German to “appreciate” that :)
There is hidden (
display:none) picture for that in the Wikipedia page source:
<tr> <td class="navbox-abovebelow" style="background-color:#decd87;" colspan="3"> <a href="/wiki/File:All_Gizah_Pyramids.jpg" class="image"> <img alt="All Gizah Pyramids.jpg" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/af/All_Gizah_Pyramids.jpg/30px-All_Gizah_Pyramids.jpg" width="30" height="20" /> </a> <a href="/wiki/Portal:Ancient_Egypt" title="Portal:Ancient Egypt"> <b>Ancient Egypt Portal</b></a> </td> </tr>
If you click show on the right corner of that block, you would see that picture :D
It seems to be extracting the image from the last HTML
<a> tag with the attribute
image="class" on the article.