is it possible to get the thumbnail url?
Yes, sure, it's possible.
How? - well, it's depends on what is it exactly you need. Is that URL you want to display somewhere on 4images page, or is it something you need for a code of your other script.
If it's first, then we have a mod "permalinks" (can't remember exact name), maybe you can start from there