I'm parsing wikipedia infoboxes and I noticed that some infoboxes have image fields - these fields hold names of image files stashed on wikipedia somewhere. However they just contain the name of the file as is as opposed to the actual link.
I checked the links of the images on real live infoboxes and the links do not seem to be from one source but the sources vary. How can I hyperlink to an image on wikipedia considering I only have the name of the image from an infobox entry.
Have you tried http://en.wikipedia.org/wiki/File:filename.jpg
? Even if the files are located on Wikimedia Commons, the above URL should still work.
Edit: Are you trying to hotlink the image? If so, Wikipedia prohibits hotlinking. http://commons.wikimedia.org/wiki/Commons:Reusing_content_outside_Wikimedia#Hotlinking
Update 10-Jan-2019: Hotlinking is now permitted:
Hotlinking or InstantCommons: It is possible to use files directly on Commons within another website, by setting up a MediaWiki wiki with InstantCommons, ...