14

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)!

7

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 :)

We're now using Wikipedia's PageImages API; see my updated answer here.

  • So it inspects the image quite a bit, eh? Thanks. – Xeo Jun 12 '11 at 14:05
  • What happens if multiple images have the same, tallest height? – fredoverflow Jun 12 '11 at 15:31
5

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

Enter image description here

  • 1
    Was just about to post this. I don't understand what the meaning of this is, though - the image has no rel attribute, no nothing... Doesn't look clean to me – Pekka supports GoFundMonica Jun 12 '11 at 12:47
  • 2
    We found out that it is unhidden by clicking [show] on the bar at the bottom of the page, reading "Ancient Egyptian religion". It is a really tiny image at the bottom of the expanded area. – Xeo Jun 12 '11 at 12:50
-1

It seems to be extracting the image from the last HTML <a> tag with the attribute image="class" on the article.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .