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

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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

share|improve this answer
    
Thanks Anita to clear it up. God, nothing is OOTB. I would think these are simple (or may be extended properties by MS) should be included. It's like you are re-inventing the wheel all over again. –  Julie May 26 '11 at 15:29
    
Do you have a sample link where it's done? Under time crunch and dont want to reinvent the wheel if it's already done. –  Julie May 26 '11 at 22:51
    
Sorry, don't have a sample on this one. –  Anita Boerboom May 28 '11 at 14:57

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 description is presented below.

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 my blog post.

share|improve this answer

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.