See my previous post. This version should allow for gaps in the number sequence and allow for setting the number of images higher than the actual number. However, don't set it too much higher, nor allow there to be a lot of gaps in the sequence. Either would waste a lot of time in processing:
Code:
<div id="thumbviewertarget"></div>
<script type="text/javascript">
(function(){
var numimages = 1000; //set to the number of images
var basepath = 'http://abetterquilt.com/portfolio/2010/'; //path to image folder
var ext = '.jpg'; //image extension to use
var height = '125px'; //height for thumbnail
var targetdiv = document.getElementById('thumbviewertarget'), curim = 0, link, img, src;
function padnum(num){
num += '';
while(num.length < 4){
num = '0' + num;
}
return num;
}
while(--numimages > -1){
src = basepath + padnum(++curim) + ext;
link = document.createElement('a');
link.href = src;
link.rel = 'thumbnail';
targetdiv.appendChild(link);
img = document.createElement('img');
(function(img, link){
img.onerror = function(){
targetdiv.removeChild(link);
link = img = null;
};
})(img, link);
img.src = src;
if(img && link){
img.style.height = height;
link.appendChild(img);
}
}
})();
</script>
Bookmarks