Question

I added a link column in my picture library and populated with links. Then added SP OOTB picture library slide show web part. Both pictures and it's description are showing. I need the link to be on the image so when user click on image it goes to whatever I put in the link field.

Was it helpful?

Solution

This is not OOTB functionality of the slide show webpart. To accomplish this behaviour you can extend the webpart to add the functionality or you can set the link with jQuery/SPServices.

Regards, Anita

OTHER TIPS

Picture Library SlideShow web part class is marked a sealed, so there is no way to extend it.

But it could be customized on the client side, the solution presented below demonstrates how to customize SlideShow control.

Load custom Picture Library fields

The following fields are loaded via SPQuery from Picture Library in Picture Library SlideShow web part:

  • Title - picture title
  • Description - picture description
  • EncodedAbsWebImgUrl – Url of web image is used for displaying picture
  • EncodedAbsUrl – Url of original image is used for picture link
  • ImageWidth – picture width
  • ImageHeight – picture height

So, in order to specify custom field for picture link we need to load it also. Loading of additional fields could happen during Slideshow initialization on the client side.

Specify custom field value for picture link

After custom fields are loaded, we need only to modify custom picture link values.
To accomplish it we will override JavaScript function for initializing picture.

The code below demonstrates how to override ShowPic function that is used for initializing picture in SlideShow:

<script type="text/javascript">


function SlideshowObjectInitializer() {

  ShowPic = (function(ShowPicOrig) {
      return function() {

           var ssObj = arguments[0];  //SlideShow object
           var curPicIdx=ssObj.index; //current picture index

           ShowPicOrig.apply(this, arguments); //call original ShowPic


           ssObj.link.href = '';  //<--put your custom picture link url here 

      };
  })(ShowPic);

}  


ExecuteOrDelayUntilScriptLoaded(SlideshowObjectInitializer, 'imglib.js');
</script>

For implementation details please follow this blog post.

There is OOTB Functionality in 2013 to complete this task and it can all be done with Site Collection Admin Permission Level (it can be done better with Farm Admin, but that gets more complicated, so I won't cover that)

  1. Add Picture Library and populate with Pictures
  2. Go to Site Settings > Site Columns (under Web Designer Galleries)> Create new Site Column

    Column Name: Slide URL-Text (You can name this whatever you want, but remember what you name it)
    Column Type: Single Line of text

  3. Go back to Picture Library you created in Step 1. Go to Library Settings > Add from existing site columns > Slide URL-Text
  4. Now Edit each picture in your library and add the URL you wish to link to in the Slide URL-Text box, and wait for the a full search crawl to occur or run it manually if you have Farm Admin - by default this happens every hour
  5. Edit the page where you want the Slide show, add the web part if you haven't already and then click Edit Web Part
  6. Change the Property Mappings by selecting the checkbox 'Change the property mapping of managed properties for the fields in the Item Display Template'
  7. In The Link URL Field, find your Slide URL-Text field and enter it here - change nothing else. Click Ok, and Save / Publish your page. See image below

    Slide Show - Web Part Edit

    You'll notice SharePoint removes spaces and adds letters usually OWSTEXT either in front of or behind your column - this is where having Farm Admin comes in handy so you can customize the managed property to display how you desire, as well as being able to use a hyperlink field for this same purpose

You're Done. Everything should work!
Make sure you wait for a full crawl to occur(you may need to wait overnight, depending on how your search timer jobs are set. Ask your SharePoint admin how often a full crawl happens if you aren't sure.

Good luck!

Important Note: Don't try to use a Hyperlink field for this without knowing what you're doing with Crawled / Managed properties as you will need to map the hyperlinked crawled property to a Managed Property of Text type, else the Slideshow WebPart Display Template will display a nasty error on you.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top