>var photos = new Array(1); >var currentphoto = 0; >photos[0] = 'photos/file1.jpg'; >photos[1] = 'photos/file2.jpg'; >photos[2] = 'photos/file3.jpg'; >>
><?php >echo("<Script language='javascript'>"); >echo("var photos = new Array(1);"); >echo("var comments = new Array(1);"); >echo("var currentphoto = 0;"); >$dir = "d:\montrealhouse\photos"; >$i = 0; >$oShell = new COM("shell.application"); >// Open a known directory, and proceed to read its contents >if (is_dir($dir)) { > if ($dh = opendir($dir)) { > while (($file = readdir($dh)) !== false) { > $fext = substr(strrchr($file, "."), 1); > if ($fext == "jpg") { > echo "photos[".$i."] = 'photos/".$file."';"; > $oDir = $oShell->Namespace($dir); > $ofile = $oDir->parsename($file); > $comment = $oDir->GetDetailsOf($ofile,14); > $comment = str_replace('"',"",$comment); > $comment = str_replace("'","",$comment); > echo("comments[".$i."] = '".$comment."';"); > $i=$i+1; > } > } > closedir($dh); > } >} >echo("function setPhoto(cnt) {"); >echo("var img = document.getElementById('imgPhoto');"); >echo("var txt = document.getElementById('spnComments');"); >echo("var indx = currentphoto+cnt;"); >echo("if(indx < 0 ) {indx = photos.length-1};"); >echo("if(indx > photos.length-1 ) {indx = 0};"); >echo("currentphoto = indx;"); >echo("if(document.all) {"); >echo("txt.innerText = comments[indx];"); >echo("} else {"); >echo("txt.textContent = comments[indx];}"); >echo("img.src=photos[indx];}"); >echo("</Script>"); >?> >>