On Wed, Nov 2, 2011 at 11:49 AM, Jeroen De Dauw <jeroendedauw(a)gmail.com>wrote;wrote:
Hey,
Is there a nice way to obtain the first image on a page?
My current solution works, but is not very nice:
* get the images on the page via
api.php?action=query&prop=images&titles=pagename
* get the page contest via index.php?title=pagename&action=raw
* find the first occurrence of one of the image names obtained in the API
request
The question is what to call "first". First images on many pages are
icons
from maintenance templates, you know:) Or the first image in page text is
displayed at the bottom of the page with CSS. Or it may be generated by
template and not be visible in wikitext.
--
Best regards,
Max Semenik ([[User:MaxSem]])