Colm McMullan schrieb:
I've been working on the wikipedia data overlay on
our site,
multimap.com. One of the things we'd really love to do is add
thumbnail images to complement the summary text for an article that we
display in our infoboxes. However, we're finding it difficult to
programatically generate the URLs to specific images from the wiki tag.
For example, how do i get from:
[[Image:Asperger kl2.jpg|thumb|[[Hans Asperger]]
to
http://upload.wikimedia.org/wikipedia/en/5/57/Asperger_kl2.jpg
Special:Filepath:/Asperger kl2.jpg is what you're searching for; it
gives you an HTTP redirect with a Location: header. Apply the regexp
preg_match("/Location\: (.*)\r\n/i",$html,$return); to the HTTP headers,
and you'll find in $return[1] the URI to the image.
And I would be careful with the thumbnails, only those which are
actually used on wiki(m|p)edia are present AFAIR.
Marco