How do I add thumbnails to an asset library custom view list view web part.


  • This has me absolutely puzzled. I'm trying to create an image gallery using an asset library (I'm not using an image library because I want to be able to use the datasheet view to bulk edit metadata). Now I know there are thumbnails automatically created for images uploaded to the asset library and that they are stored in a subdirectory of the asset library called "/t" and have the extension changed to _ext.ext from .ext

    I also know that that Thumbnails.aspx and AllItems.aspx display said thumbnails. AllItems seems to use the ThumbnailOnForm field but I'm not sure what causes it to link to the thumbnail because ThumbnailOnForm's value is the large version of the image.

    How do I actually add the thumbnail to my custom view.

    I'm confused to why the asset library creates thumbnails and yet doesn't include a column for the URL to said thumbnails. What was Microsoft's thinking behind this?

    For what its worth I'm using Sharepoint Designer.

    Saturday, February 26, 2011 2:13 AM

All replies

  • In sharepoint designer edit the column you want to show the thumbnail and set it up like this:

    <img src="/path/library/t/{@Name}"/>

    You'll need to do a substring of the @Name field to change the extension. But can't recall the exact syntax off the top of my head at the moment. Should be substring-before(@Name, ".") :)

    SharePoint 2010 Extensions - My Blog - Twitter -!/withnsharepoint
    Saturday, February 26, 2011 3:44 AM
  • It's actually Library/_t/file_ext.jpg

    SharePoint creates thumbnails for the files in that directory and it creates them as jpgs. So it could be myfile_png.jpg or myfile_gif.jpg.

    It also creates a slighter larger file at Library/_w with the same naming as above.

    So for instance when you go to a picture library what you are seeing is the _t version and when you click to DispForm.aspx you get the _w version, then you click on that you get the actual image.

    -tom daly
    Monday, February 28, 2011 5:27 AM
  • Thanks. I wasn't sure how to do the whole substring thing, but with that term I did some more googling and found this which helped me.

    • Proposed as answer by Mohamed Derhalli Tuesday, March 01, 2011 2:40 AM
    • Marked as answer by fallenturtle Wednesday, March 02, 2011 12:19 AM
    • Unmarked as answer by fallenturtle Thursday, March 03, 2011 5:22 PM
    Monday, February 28, 2011 7:50 PM
  • Thanks. I wasn't sure how to do the whole substring thing, but with that term I did some more googling and found this which helped me.

    Am I correct in thinking its not possible to do something similar with the XSLT List View Webpart?

    I think I'm coming to the frustrating conclusion that what I want to do is impossible because it would essentially be a combination of features from the data view web part and list view web part. Basically I want the power of the data view list part (so I can have a thumbnail that's linkable to the full size image and be able to customize the table so that its just two cells per entry, one cell with the thumbnail and to the right of that a cell with the metadata I want to display) and then have this as two columns, similar to the boxed view style. While I can do all that with the data view, the list view has the ability to allow me to have sorting and filters in the headers. While there is the List Filter web part for the data view web part, I don't like how there's no way to clear the filter and on top of that there's a bug in Sharepoint that makes the filter not pull all the values its suppose to.

    This is a screenshot of how I want it to look.

    The other screwy thing is that while I can setup the data view web part to look like that and it displays correctly in my browser, when I try to check the file in (after being checked out, of course) SP Designer says "Cannot perform this operation. The file is no longer checked out or has been deleted." After that, if I reload the page all my work is gone. If I check the page out again, it comes back. Sharepoint is really good at raising my blood pressure. :/

    Wednesday, March 02, 2011 11:40 PM