4

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.

  • Create a custom webpart with SPgridview. – Nikhil J Mar 12 '14 at 21:12
2

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>
0

I believe you're looking for the Lookup field

  • 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
0

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" />
  • 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
0

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

-1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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