Forum:Javascript Function:Returning the File Path of an Image -- how to

I have been meaning to ask if we can create a javascript function that return the full URL of a file/image. Kind of like this:

ex: returnFilePath("File:LaLigaDay2-Peak Attendance.jpg",300); would return the string http://images3.wikia.nocookie.net/__cb20110403193661/laliga/images/thumb/3/37/LaLigaDay2-Peak_Attendance.jpg/300px-LaLigaDay2-Peak_Attendance.jpg

I have been experimenting on how to calculate the "__cb20110403193661" and the "3/37" parts, but I guess looping it is getting ridiculous, ahaha ^^. Unfortunately, I don't know any thing about Ajax, PHP, Java, etc or any other languages other than javascript. So I would humbly appreciate it if somebody replied the full code of the function. Thank you in advance. - M.Fü. Ken 06:30, April 28, 2011 (UTC) of La Liga Wikia


 * will do that without having to use javascript. Example:
 * Sovq 07:36, April 28, 2011 (UTC)
 * Sovq 07:36, April 28, 2011 (UTC)


 * If the parser isn't usable, you might be able to query the filepath with an Ajax request to api.php.