Last modified: 2012-08-28 09:58:09 UTC
I can retrieve all images used on a page but not the first. [[File:Foo.jpg]] Text [[File:Bar.jpg]] How can I retrieve Foo.jpg?
I don't think it's stored in way you can find out.. For example on my dev wiki, it seems they are returned in alphabetical order <page pageid="1" ns="0" title="Main Page"> <images> <im ns="6" title="File:Blah.png" /> <im ns="6" title="File:Sommeimagge.png" /> mysql> select * from mw_imagelinks; +---------+------------------------------------------------+ | il_from | il_to | +---------+------------------------------------------------+ | 1 | Blah.png | | 1 | Sommeimagge.png | You'd probably have to regex scrape the page text...
>You'd probably have to regex scrape the page text... Doing ?action=parse and looking at the image links output might be in order of appearance in page (since the results come the parse). Most js tools that do this (for example [[n:WN:ML]] just regex scape it as far as I know. ----- I do not think there is a compelling reason to go to the trouble of storing this in the db and providing specific mechanisms in the api to extract it.
How can I retrieve the source text without JS in an extension and without the API?
Construct a new Revision object, and look at the getText functions.
Cheers! $rev = Revision::newFromTitle( $title ); $text = $rev->getText();