Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a requirement to add a thumbnail image column into an existing document library on my SharePoint 2010 site.

Thumbnail images for each document are uploaded to the images document library. When a new document gets added to the main document library on the site, I would like the user to be able to select an image from the image document library, and this will be displayed on the site.

I have tried using a “hyperlink or picture” column, and all works fine and the image renders correctly, but there is no image picker (this makes it difficult for users to use). If I add a “publishing image” column instead, it provides the picker, but the I don’t see the image on site, instead I get the html markup for the image tag rendered to the screen.

Is there any way to get an image picker control attached to the hyperlink or picture column, or get the publishing image column to render correctly.

I don’t have the availability to do anything in Visual Studio, but do have SharePoint Designer.

share|improve this question
    
Create a custom webpart with SPgridview. –  Nikhil Mar 12 at 21:12
add comment

5 Answers 5

You can use XSLT

Select your fields for the Data View web part and select Url Path. Something like this will be added

<img border="0" src="{@FileRef}" alt="{@FileRef}"/>

Below code is used for an picture library’s auto-created thumbnail. You need to get the URL to the picture libary.This could be something like this

concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),
'_',substring-after(@FileLeafRef,'.'),'.',@FileType)

@FileDirRef is the name of the library 
@FileLeafRef is the file name     
@FileType is the file typ

substring-before / after are XSLT string functions

The final 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 in 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>
share|improve this answer
add comment

I believe you're looking for the Lookup field

share|improve this answer
    
This works, but only gives you a list of filenames. When there are more than an handfull of images, it doesn't work too well, and if possible I'd like the user to see the actual image they are picking. –  AndyPeacock Dec 5 '11 at 13:41
add comment

In designer, you have to escape the rich HTML column by adding the disable-output-escaping attribute:

<xsl:value-of select="@RichColumnName" disable-output-escaping="yes" />
share|improve this answer
    
I tried that too I'm afraid. With DOE set to no, you get an encoded version of the html markup rendered (&lt; etc) with it set to yes, you get the actual markup instead. –  AndyPeacock Dec 7 '11 at 8:44
add comment

Well, I doubt that OOTB experience might be good. I would recommend to look any opensource/commercial solution to implement nice Image field.

Actually, there are a lot of them, but I had nice experience with AreaProg ToolboxImage Column - http://areaprog.codeplex.com

share|improve this answer
add comment

Another open source solution for uploading and displaying images in lists and Document Libraries: http://sparqubepicturelite.codeplex.com/

share|improve this answer
    
While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference. See answer for general guidelines. Also we require disclosure of any affiliation with products or websites. Please see May I promote products or websites I am affiliated with here? for guidelines. –  SPDoctor Apr 4 '13 at 20:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.