"The day you stop learning SharePoint is the day you stop using it."

Picture Library SlideShow Web Part not displaying image in original size

This is a known fact that out-of-the-box Picture Library SlideShow Web Part does not display the images in its original size. Further more, unfortunately it is not supported to configure in web part what image type (original, web or thumbnail) should be displayed in Slideshow.

The JavaScript code described below allows to display original images (without re-sizing) in Slideshow Web Part. In order to display original image the technique is to override the ShowPic function. For embedding JavaScript on page, use Content Editor web part (CEWP) on the same page where you have also inserted your SlideShow web part.

<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

           //apply some changes to display original picture in SlideShow control
           ssObj.image.src = ssObj.linkArray[curPicIdx]; //display original image instead of web image
           //change picture & container size to auto instead of fixed (by default web image size is used)
             ssObj.image.setAttribute('height','100%'); 
             ssObj.image.setAttribute('width','100%'); 
             var cell = ssObj.cell; 
             cell.style.width = 'auto';
             cell.style.height = 'auto';
             cell.style.display = '';
             var pcell = ssObj.cell.parentNode; 
           pcell.style.width = 'auto';
             pcell.style.height = 'auto';
      };
  })(ShowPic);

}  


ExecuteOrDelayUntilScriptLoaded(SlideshowObjectInitializer, 'imglib.js');
</script>
In the above given code you can adjust the size by modifying these lines/values:
ssObj.image.setAttribute('height','100%'); 
ssObj.image.setAttribute('width','100%');
The value '100%' can be changed to '90%' or '80%' and even in pixels you can mention the size, example:
ssObj.image.setAttribute('height','400'); 
ssObj.image.setAttribute('width','700');




Share:

SharePoint-StackExchange Moderator

Author's Profile

My photo
India
A SharePoint Enthusiast working as a Lead Solution Architect for an IT Software & Consulting Company in Mumbai. I believe in giving back to the community through which I also learn and develop and eventually grow as an individual and professional. This blog is a small contribution to the community where I live in and may help someone who is seeking knowledge like me.

Popular Posts

Powered by Blogger.

Contact Form

Name

Email *

Message *

Total Pageviews