This is in response to a question about displaying a thumbnail from a Picture Library in a Data View web part…
Displaying the full size picture is really easy. When selecting your fields for the Data View web part select “Url Path”. This will be added to the XSLT of the Data View web part as:
<img border="0" src="{@FileRef}" alt="{@FileRef}"/>
(@FileRef is the XSLT fieldname used for “Url Path”)
The trick is getting the URL to the picture library’s auto-created thumbnail. The thumbnail for “test.jpg” is “/_t/test_jpg.jpg” and is not a field in the SharePoint Designer list of fields. To get it you will need to do some XSLT string work:
concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)
Note: the above will only work if only one “.” exists in the file name. It will fail for a file named my.airshow.picture.jpg
@FileDirRef is the name of the library (airshow%20pictures)
@FileLeafRef is the file name (helicopter.jpg)
@FileType is the file type (jpg)
‘/_t/’ is the path to the auto-created thumbnails
substring-before / after are XSLT string functions
The above “stuff” will convert:
/airshow%20pictures/helicopter.jpg
into
/airshow%20pictures/_t/helicopter_jpg.jpg
which is the path to the thumbnail.
The final <IMG> tag looks like this:
<img border="0" src="{concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)}" alt="{@FileRef}"/>
If you would like to let the user click on the thumbnail to see the full picture and meta data then wrap the <IMG> in a <A> tag and supply the ID of the picture:
<a href="{concat(@FileDirRef,'/Forms/DispForm.aspx?ID=', @ID)}">
<img border="0" src="{concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)}" alt="{@FileRef}"/>
</a>