Silver Arrow Systems

DWP: Dynamic Slideshow

This web part scans a directory (or document library) of images and loops through all of them, displaying a slideshow of each image found. The images must be named with an incrementing number, which can be padded to a certain length. A constant prefix across all the image files is optional. The slideshow loops around to the beginning after it reaches the end of the discovered images.
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>Dynamic Slideshow</Title>
<FrameType>None</FrameType>
<Description>JavaScript slideshow that loops through all images in a directory.</Description>
<IsIncluded>true</IsIncluded>
<ZoneID>Left</ZoneID>
<PartOrder>1</PartOrder>
<FrameState>Normal</FrameState>
<Height />
<Width />
<AllowRemove>true</AllowRemove>
<AllowZoneChange>true</AllowZoneChange>
<AllowMinimize>true</AllowMinimize>
<AllowConnect>true</AllowConnect>
<AllowEdit>true</AllowEdit>
<AllowHide>true</AllowHide>
<IsVisible>true</IsVisible>
<DetailLink />
<HelpLink />
<HelpMode>Modeless</HelpMode>
<Dir>Default</Dir>
<PartImageSmall />
<MissingAssembly>Cannot import this Web Part.</MissingAssembly>
<PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
<IsIncludedFilter />
<Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[<div id="CEWP_Slideshow_Wrapper"></div>
<script type="text/javascript">
//Global declarations
var dir = "path/to/images", //Directory to scan - use absolute path for best results
pre = "slide_", //Image file prefix
pad = 2, //Digit padding length (use -1 for no padding)
ext = ".png", //Image extension (format)
init = 1, //Initial slide number
speed = 1000, //Duration to display each image in milliseconds (1000 ms = 1 second)
slide, slidemax, tickinterval, slimg, sldiv;

function padFct(a){if(pad!==-1){return("000000000000000"+a).slice(-pad)}return a}function checkImageFct(b){var a=new XMLHttpRequest();a.open("HEAD",b,false);a.send();return a.status!=404}function getPathFct(a){var a=a||slide;return dir+pre+padFct(a)+ext}function initSlideshowFct(){slide=init;slidemax=init;sldiv=document.getElementById("CEWP_Slideshow_Wrapper");sldiv.innerHTML="<img id='CEWP_Slideshow_Image' src='"+getPathFct()+"'>";slimg=document.getElementById("CEWP_Slideshow_Image");while(true){if(!checkImageFct(getPathFct(slidemax))){break}slidemax+=1}tickinterval=setInterval(tickSlideshowFct,speed)}function tickSlideshowFct(){slide+=1;if(slide===slidemax){slide=init}slimg.src=getPathFct()}; initSlideshowFct();
</script>

<!-- Dynamic Folder Slideshow Web Part v1.0.0 -->
<!-- All code copyright © 2014 Silver Arrow Systems. All rights reserved. -->
<!-- Usage and redistribution of this web part is restricted to individuals with permission expressly granted by Silver Arrow Systems (hereafter referred to as Licensed Users). -->
<!-- Licensed Users may use, modify, and redistribute this web part without any restrictions. -->
<!-- Individuals without permission expressly granted by Silver Arrow Systems (hereafter referred to as Unlicensed Users) may use and redistribute, but not modify this web part. -->
<!-- Unlicensed Users must keep this copyright notice intact in all usages or redistributions of this web part. -->
<!-- No user may hold Silver Arrow Systems responsible for any damages incurred by or because of this web part, its contents, or its usage. -->
<!-- http://www.silverarrowsystems.com -->]]></Content>
<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
</WebPart>
How to use this web part:
Setup:
- Have a folder or document library somewhere with the pictures you want in it.
- If you're using a document library, make sure you get the URL where the images are stored, not the URL of the document library.
Install options:
- Copy and paste this code, then save as a .dwp file (file will use default options).
- Download as a .dwp file (file will use default options).
- NEW! Use our custom DWP builder to set all your own options.
Don't know how to install a DWP?
Check out our tutorial for SharePoint 2010 (SharePoint 2007 and 2013 tutorials coming soon.)
X

Silver Arrow Systems Custom DWP Builder

Step 1: Set your options. All fields are required unless otherwise noted.

Step 2: Click the button.

Generate custom DWP
All fields are required unless otherwise noted.

Step 3: Copy and paste this text, then save as a .dwp file.