Extracting link to image

I am working on improving the mobile display for one of our Omeka instances. As of now, when a mobile browser is detected,

if($ismobile) {
echo files_for_item(array('imageSize' => 'thumbnail'));

When they click on the image, the original file is downloaded. What I would like instead is for the thumbnail to link instead to a display (in the browser) of the fullsize image. In short,

if($ismobile) {
echo '<div id="itemfiles" class="element"><a href="fullsize.jpg>
<img src="thumbnail.jpg" />

In order to do this, though, I need to be able to extract the links to the images from the functions that call them up. Is this possible?

You should be able to just specify the linkToFile option for files_for_item:

echo files_for_item(array('imageSize' => 'thumbnail', 'linkToFile' => 'fullsize'));

Oh wow, I missed that option entirely. Thanks so much!

Agree with John Flatness,you must specify linkToFile better than using files_for_item.

I have just done the same Here