Previous Thread
Next Thread
Print Thread
Rate Thread
#18928 10/18/02 02:05 AM
Joined: Apr 2002
Posts: 730
UGN Supporter
OP Offline
UGN Supporter
Joined: Apr 2002
Posts: 730
is there a way to create a slideshow using all the pictures in a particular directory rather than specifying every picture name, etc. Like if u wanted to make a slideshow from the pictures in
www.moffesto.com/pictures/

or do u have to specify every lil file name. ext. etc. It would take a load off if i could do this smile .


2 people can keep a secret as long as one is dead
#18929 10/18/02 12:03 PM
Joined: Mar 2002
Posts: 599
UGN's Resident Homo
Offline
UGN's Resident Homo
Joined: Mar 2002
Posts: 599
i don't know if thats possible, but another way to save time could be to name all the images in numerical order 1,2,3, etc. and then use a loop in your code to load the image one and then add 1 to the variable so that when it loops back through the code it loads image 2....


"It's better to burn out, than to fade away."
#18930 10/18/02 12:56 PM
Joined: Oct 2002
Posts: 37
Junior Member
Offline
Junior Member
Joined: Oct 2002
Posts: 37
Yep. Pretty simple. If you are using Perl that is. I don't know whether the other scripting languages are capable of it. All you need to do with Perl is just open the directory and read the contents from it. I can post examples of this if you want.

#18931 10/18/02 04:57 PM
Joined: Mar 2002
Posts: 562
UGN Supporter
Offline
UGN Supporter
Joined: Mar 2002
Posts: 562
My BBS uses a JavaScript to read the contents of a directory for smiles, and avantars

#18932 10/20/02 07:09 PM
Joined: Apr 2002
Posts: 730
UGN Supporter
OP Offline
UGN Supporter
Joined: Apr 2002
Posts: 730
sure ninja dude, if it will help. I dunno [censored] about perl but if it will help my site ill read.


2 people can keep a secret as long as one is dead
#18933 10/21/02 04:42 AM
Joined: Oct 2002
Posts: 37
Junior Member
Offline
Junior Member
Joined: Oct 2002
Posts: 37
Code
my $directory = "/location/of/images";
my $file;
opendir(IMAGES, $directory) or die "Can't open $directory:\n";
while (defined($file = readdir IMAGES)) {
    print "<img src=" . $directory . $file . ">\n";
}
closedir(IMAGES);
That's how I'd do it.

#18934 10/21/02 04:22 PM
Joined: Apr 2002
Posts: 730
UGN Supporter
OP Offline
UGN Supporter
Joined: Apr 2002
Posts: 730
... and u can just insert that into the html or what? if so... the body? head?


2 people can keep a secret as long as one is dead
#18935 10/22/02 09:20 AM
Joined: Oct 2002
Posts: 37
Junior Member
Offline
Junior Member
Joined: Oct 2002
Posts: 37
Nope. You can't insert Perl directly into HTML unless you are running ASP or SSI. You should create a seperate file containing that and then call it. If someone mentioned they know a way to do it using Javascript, I'd recommend doing it that way unless you really wanted to be creative about it. Then learn how I'd do it.

#18936 10/22/02 02:33 PM
Joined: Apr 2002
Posts: 730
UGN Supporter
OP Offline
UGN Supporter
Joined: Apr 2002
Posts: 730
what do i call the separate file? like whats the extension name i need to use?


2 people can keep a secret as long as one is dead
#18937 10/22/02 07:34 PM
Joined: Oct 2002
Posts: 37
Junior Member
Offline
Junior Member
Joined: Oct 2002
Posts: 37
.[censored] if you own the webserver and can set that up. Otherwise call it .cgi and put it in a cgi-bin directory.

#18938 10/22/02 08:07 PM
Joined: Mar 2002
Posts: 217
Member
Offline
Member
Joined: Mar 2002
Posts: 217
lol @ .[censored]. We got comedian coders.

#18939 10/23/02 05:40 PM
Joined: Apr 2002
Posts: 730
UGN Supporter
OP Offline
UGN Supporter
Joined: Apr 2002
Posts: 730
sweet


2 people can keep a secret as long as one is dead
#18940 12/06/02 09:09 PM
Joined: Sep 2002
Posts: 71
Junior Member
Offline
Junior Member
Joined: Sep 2002
Posts: 71
Try this, I dunno if its exactlly what your looking for, but its a cool slide show...

Code
<script language=JavaScript type=text/javascript>
<!--
// JavaScript
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

// Jump into frames
//if (self==top) { top.location.href="webdesign.html"; }

// Code for the DHTML animation
// Modified from original created by:
// http://www.sebchevrel.com - cheers Seb!
var topx=0;
var ttx=0;
var otopx=0;
var otopx2=0;
var px=0;
var opx=0;
var numItems=8;
var winW=0;
var contentW=0;
var HW=0;
var prjNum=0;
var projectNum=0;
var offsetW=180;
var scrDirection=0;
var showProject=0;
var viewNum=0;

function init() {
	startMouseCapture();
	winW=getwindowWidth();
	contentW=(numItems+1)*220;
	TW=1550-winW;
	HW=contentW;		// amount to scroll
	lastx=mouseX;		// last mouse coord, for movement detection
	leftX=250;			// left scroll hot zone
	rightX=550;			// right
	scrollm=80;			// minimum scroll (first)
	scrollM=-HW+750-220;// maximum scroll (last) 750:=winW
	px=120;				// initial position
	opx=0;				// last position
	vx=0;				// initial velocity def: -200
	minmove=5;			// minimum mouse movement to trigger scroll/stop (in pixels)
	speed=32;			// maximum scroll speed at edge (in pixels/frame) def: 128
	lastsign=0;
	// Let's rock!
	animate();
}		

function endProject() { // Returns back to the list
	MM_showHideLayers('instruct','','hide');
	MM_showHideLayers('overlay'+projectNum,'','hide');
	if (projectNum+2 <=numItems) {MM_showHideLayers('project'+(projectNum+2),'','show');}
	MM_showHideLayers('selectorback','','show');
	MM_showHideLayers('basePos','','show');
	MM_showHideLayers('selectorbar','','show');
	prjNum=0; projectNum=0;
	showProject=0;
	// if (viewNum==3) {location.reload();viewNum=0;} // Refresh page after 3 project views to stop slowdown bug
}

function viewProject(prjNum) { // View details of a particular project
	if (prjNum>0 & showProject==0) {
		projectNum=prjNum;
		if (px+(projectNum*220)>315) { scrDirection=670; }
		else if (px+(projectNum*220)<285) {scrDirection=130; }
		else {scrDirection=400;}
	}
	else { endProject(); }
	
}

function animate() {
	// Top image movements
	if (mouseX>offsetW) {
		txa=(winW*(mouseX-offsetW))/(winW-offsetW);
		tx=txa/winW * HW -160;		// menu target
		ttx2=txa/winW * TW;
	} else {
		tx=1/winW * HW -160;
		ttx2=1/winW * TW;
	}

	topx2=(otopx2-ttx2)/2;
	
	// **** Start project scroll ****
	if (showProject==0 ) {



	// Track mouse speed and last moving direction above threshold
	x=mouseX;
	if (projectNum>0) { x=scrDirection; } //Start moving to project
	dx=x-lastx; lastx=x;
	if (dx>0) { dxsign=-1; if (dx>minmove) lastsign=-1; }
	else if (dx<0) { dxsign=1; dx=-dx; if (dx>minmove) lastsign=1; }
	else dxsign=0;
	
	// Scroll Zones
	if (x<leftX)  {
		a=(leftX-x)/leftX;					// normalize scroll speed within zone
		if (lastsign==-1) vx*=0.6;			// if last move reverse direction, stop
		else if (lastsign==1) vx=a*speed;	// if last move forward, scroll at normalized speed
	}
	
	if (x>rightX) {
		a=(x-rightX)/leftX;
		if (lastsign==1) vx*=0.6;
		else if (lastsign==-1) vx=-a*speed;
	}
	
	// Apply speed and friction
	px+=vx;
	vx*=0.8;
	px=Math.round(px);

	// Boundaries Check
	if (px>scrollm) px=scrollm;
	else if (px< scrollM) px=scrollM;

	// Only move the layers if necessary				
	if (px!=opx) {
		txsel=Math.round(164-(px*0.089));
		Movelayer('selectorback',txsel,171);
		for (i=1; i<=numItems; i++) {
			tpx=px+(i-1)*220;
 			//MoveClippedLayer('project'+i,tpx-80,0);
			if ( (tpx>-220) && (tpx<720) ) { MM_showHideLayers('project'+i,'','show'); MoveClippedLayer('project'+i,tpx-80,0); }
			else MM_showHideLayers('project'+i,'','hide');
		}
	}
	opx=px;	
	}
	// end project scroll
	
	// Check to see whether at project #, if requested
	if (projectNum!=0 & showProject==0) {
		if (px+(projectNum*220)>285 & px+(projectNum*220)<315) {
			showProject=1;viewNum++;
			MM_showHideLayers('selectorback','','hide');
			MM_showHideLayers('selectorbar','','hide');
			MM_showHideLayers('basePos','','hide');
			MM_showHideLayers('overlay'+projectNum,'','show');
			MM_showHideLayers('instruct','','show');
			if (projectNum+2 <= numItems) {MM_showHideLayers('project'+(projectNum+2),'','hide');} // hide the project still showing
			srcDirection=0;
		}
	}
	
	// Set selector bar position
	sbx=(mouseX/winW)*67;
	if (sbx<12) sbx=12;
	if (sbx>67) sbx=67;
	
	if ( Math.abs(topx2-otopx)>1) {	Movelayer('topstrip',topx2,0);}
	Movelayer('selectorbar',txsel+sbx,172);
	// Movelayer('digits2',mouseX-2500,273);
	otopx2=topx2;
	setTimeout('animate()',30);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW &#0124;&#0124; innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//-->
</script>


Link Copied to Clipboard
Member Spotlight
Phatal
Phatal
Houston, TX
Posts: 298
Joined: April 2004
Forum Statistics
Forums41
Topics33,840
Posts68,858
Average Daily Posts1
Members2,176
Most Online3,253
Jan 13th, 2020
Latest Postings
Where and how do you torrent?
by danni75 - 03/01/24 05:58 AM
Animation,
by JohanKaariainen - 08/15/19 01:18 AM
Blackbeard.....
by Gremelin - 10/03/18 07:02 PM
my old account still exists!
by Crime - 08/10/18 02:47 PM
Okay WTF?
by HenryMiring - 09/27/17 01:45 AM
The History Thread...
by Gremelin - 08/11/17 12:11 PM
My friend NEEDS your HELP!
by Lena01 - 07/21/17 12:06 AM
I'm having fun with this guy.
by gabithompson730 - 07/20/17 01:50 AM
I want to upgrade my phone
by gabithompson730 - 07/20/17 01:49 AM
Doom 3
by Cyrez - 09/11/14 08:58 PM
Amazon Gift Card Generator/KeyGen?te
by Gecko666 - 08/22/14 09:21 AM
AIM scene 99-03
by lavos - 09/02/13 08:06 AM
Planetside 2
by Crime - 03/04/13 07:10 AM
Beta Testers Wanted
by Crime - 03/04/13 06:55 AM
Hello Everyone
by Gremelin - 02/12/12 06:01 PM
Tracfone ESN Generator
by Zanvin Green - 01/18/12 01:31 PM
Python 3 issue
by Testing - 12/17/11 09:28 PM
tracfone airtime
by Drache86 - 07/30/11 03:37 AM
Backdoors and the Infinite
by ZeroCoolStar - 07/10/11 03:52 AM
HackThisZIne #12 Releaseed!
by Pipat2 - 04/28/11 09:20 PM
gang wars? l33t-wars?
by Gremelin - 04/28/11 05:56 AM
Consolidate Forums
by diggin2deep - 04/21/11 10:02 AM
LAN Hacking Noob
by Gremelin - 03/12/11 12:42 AM
Top Posters
UGN Security 41,392
Gremelin 7,203
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Likes Received
Ghost 2
Cyrez 1
Girlie 1
unreal 1
Crime 1
Powered by UBB.threads™ PHP Forum Software 7.7.5