Hej alle
Har et spørgsmål om et slideshow, måske der er et der kan hjælp med??
Nedstående kode virker fint, men det kræver at det er i dette mappe hvor der skal vises billeder fra.
Jeg vil gerne have at jeg kan include() det i forskellige sider og vis billeder fra bestemt mapper.
er der en der kan hjælp????
På forhånd TAK.
<?php
$include = "_include/";
$headline = "Lytzen IT - Om Lyten IT";
$photosby = "photos from the world wide web";
$autostart = true; // true; or false;
$slideeffect = "5"; // "0"; - "15";
// Slideeffects: 0=Blend, 1=Blinds, 2=Checker, 3=Diagonal, 4=Doors,
// 5=Gradient, 6=Iris, 7=Pinwheel, 8=Pixelate, 9=Radial,
// 10=Rain, 11=Slide, 12=Snow, 13=Spiral, 14=Stretch, 15=RANDOM!
$slidedirection = "up"; // "up"; or "down";
// Visit
http://dl.pixary.net/slideme.html for more information.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="slideme smig image gallery 1.0 gallerie galerie javascript javaskript js">
<meta name="description" content="
lideMe Image Gallery 1.0 - the gallery with slideeffects!">
<meta name="author" content="Mario B. - Pixary.net">
<title>
lideMe - Image Gallery 1.0</title>
<link rel="stylesheet" type="text/css" href="<?php echo $include ?>style.css" />
<script language="javascript" src="<?php echo $include ?>sniffer.js"></script>
</head>
<body <?php if ($autostart == true) {echo "onload='stopOrStart();'";} ?> >
<script language="JavaScript">
var timer;
var current_location = 1;
var next_location = 1;
var pics_loaded = 0;
var onoff = 0;
var timeout_value;
var images = new Array;
var photo_urls = new Array;
var photo_captions = new Array;
var photo_comment = new Array;
var photo_user_epic_comment = new Array;
var transitionNames = new Array;
var transitions = new Array;
var loop = 1;
var current_transition = <?php echo $slideeffect;?>;
var direction = <?php if ($slidedirection == "up") {echo "1";} if ($slidedirection == "down") {echo "-1";} ?>;
<?php
$handle = opendir('.');
$c=1;
while ($file = readdir ($handle)) {
if($file != "." && $file != ".."){
if(preg_match("/.(jpg|gif|png)$/i", $file)){
$fileArray[] = $file;
}
}
}
closedir($handle);
asort($fileArray);
foreach($fileArray as $row) {
echo "photo_urls[".$c."] = '".$row."';";
$c++;
}
$countimg = count($fileArray);
?>
transitions[0] = "progid
XImageTransform.Microsoft.Fade(duration=1)";
transitions[1] = "progid
XImageTransform.Microsoft.Blinds(Duration=1,bands=20)";
transitions[2] = "progid
XImageTransform.Microsoft.Checkerboard(Duration=1,squaresX=20,squaresY=20)";
transitions[3] = "progid
XImageTransform.Microsoft.Strips(Duration=1,motion=rightdown)";
transitions[4] = "progid
XImageTransform.Microsoft.Barn(Duration=1,orientation=vertical)";
transitions[5] = "progid
XImageTransform.Microsoft.GradientWipe(duration=1)";
transitions[6] = "progid
XImageTransform.Microsoft.Iris(Duration=1,motion=out)";
transitions[7] = "progid
XImageTransform.Microsoft.Wheel(Duration=1,spokes=12)";
transitions[8] = "progid
XImageTransform.Microsoft.Pixelate(maxSquare=10,duration=1)";
transitions[9] = "progid
XImageTransform.Microsoft.RadialWipe(Duration=1,wipeStyle=clock)";
transitions[10] = "progid
XImageTransform.Microsoft.RandomBars(Duration=1,orientation=vertical)";
transitions[11] = "progid
XImageTransform.Microsoft.Slide(Duration=1,slideStyle=push)";
transitions[12] = "progid
XImageTransform.Microsoft.RandomDissolve(Duration=1,orientation=vertical)";
transitions[13] = "progid
XImageTransform.Microsoft.Spiral(Duration=1,gridSizeX=40,gridSizeY=40)";
transitions[14] = "progid
XImageTransform.Microsoft.Stretch(Duration=1,stretchStyle=push)";
transitions[15] = "special case";
var transition_count = 15;
var photo_count = <?php echo $countimg; ?>;
var slideShowLow = "";
var browserCanBlend = (is_ie5_5up);
function stopOrStart() {
if (onoff) {
stop();
} else {
play();
}
}
function toggleLoop() {
if (loop) {
loop = 0;
} else {
loop = 1;
}
}
function changeElementText(id, newText) {
element = document.getElementById(id);
element.innerHTML = newText;
}
function stop() {
changeElementText("stopOrStartText", "Start Slideshow");
changeElementText("changeDirText", " ");
if (browserCanBlend) {
changeElementText("time", " ");
changeElementText("fading", " ");
}
onoff = 0;
clearTimeout(timer);
}
function play() {
changeElementText("stopOrStartText", "Pause");
if (browserCanBlend) {
if (!onoff) {
if (direction==1)
changeElementText("changeDirText", "<img src='<?php echo $include; ?>change.png' border='0'>");
else
changeElementText("changeDirText", "<img src='<?php echo $include; ?>backward.png' border='0'>");
changeElementText("time", "<select name='time' onchange='play()' class='timebox'><option value='1'> 1 Second<option value='2'> 2 Seconds<option value='3' selected> 3 Seconds<option value='5' > 5 Seconds<option value='10'> 10 Seconds</select>");
changeElementText("fading", "<select name='transitionType' onchange='change_transition()' class='fadebox'><option value='0' selected> Blend <option value='1'> Blinds <option value='2'> Checker <option value='3'> Diagonal <option value='4'> Doors <option value='5'> Gradient <option value='6'> Iris <option value='7'> Pinwheel <option value='8'> Pixelate <option value='9'> Radial <option value='10'> Rain <option value='11'> Slide <option value='12'> Snow <option value='13'> Spiral <option value='14'> Stretch <option value='15'> RANDOM! </select>");
}
}
onoff = 1;
go_to_next_photo();
}
function next() {
direction = 1;
next_location = (parseInt(current_location) + parseInt(direction));
if (next_location > photo_count) {
next_location = 1;
if (!loop) {
stop();
}
}
if (next_location == 0) {
next_location = photo_count;
if (!loop) {
stop();
}
}
current_location=next_location;
preload_photo(current_location);
document.slide.src = images[current_location].src;
setCaption(photo_captions[current_location],photo_comment[current_location],photo_user_epic_comment[current_location]);
if (onoff==1)
stop();
}
function back() {
direction = -1;
next_location = (parseInt(current_location) + parseInt(direction));
if (next_location > photo_count) {
next_location = 1;
if (!loop) {
stop();
}
}
if (next_location == 0) {
next_location = photo_count;
if (!loop) {
stop();
}
}
current_location = next_location;
preload_photo(current_location);
document.slide.src = images[current_location].src;
setCaption(photo_captions[current_location],photo_comment[current_location],photo_user_epic_comment[current_location]);
if (onoff==1)
stop();
}
function weiter() {
direction = 1;
next_location = (parseInt(current_location) + parseInt(direction));
if (next_location > photo_count) {
next_location = 1;
if (!loop) {
stop();
}
}
if (next_location == 0) {
next_location = photo_count;
if (!loop) {
stop();
}
}
current_location=next_location;
preload_photo(current_location);
document.slide.src = images[current_location].src;
setCaption(photo_captions[current_location],photo_comment[current_location],photo_user_epic_comment[current_location]);
if (onoff==1)
stop();
}
function changeDirection() {
if (direction == 1) {
direction = -1;
changeElementText("changeDirText", "<img src='<?php echo $include; ?>backward.png' border='0'>");
} else {
direction = 1;
changeElementText("changeDirText", "<img src='<?php echo $include; ?>forward.png' border='0'>");
}
setCaption(photo_captions[current_location],photo_comment[current_location],photo_user_epic_comment[current_location]);
preload_next_photo();
}
function change_transition() {
current_transition = document.smigform.transitionType.selectedIndex;
}
function preload_complete() {}
function reset_timer() {
clearTimeout(timer);
if (onoff) {
timeout_value = document.smigform.time.options[document.smigform.time.selectedIndex].value * 1000;
timer = setTimeout('go_to_next_photo()', timeout_value);
}
}
function wait_for_current_photo() {
if (!show_current_photo()) {
status = "Picture is loading...(" + current_location + " of " + photo_count + "). Please wait!" ;
clearTimeout(timer);
timer = setTimeout('wait_for_current_photo()', 505);
return 0;
}
else {
status = "Slideshow is running...";
preload_next_photo();
reset_timer();
}
}
function go_to_next_photo() {
current_location = next_location;
if (!show_current_photo()) {
wait_for_current_photo();
return 0;
}
preload_next_photo();
reset_timer();
}
function preload_next_photo() {
next_location = (parseInt(current_location) + parseInt(direction));
if (next_location > photo_count) {
next_location = 1;
if (!loop) {
stop();
}
}
if (next_location == 0) {
next_location = photo_count;
if (!loop) {
stop();
}
}
preload_photo(next_location);
}
function show_current_photo() {
if (!images[current_location] || !images[current_location].complete) {
preload_photo(current_location);
return 0;
}
if (browserCanBlend){
var do_transition;
if (current_transition == (transition_count)) {
do_transition = Math.floor(Math.random() * transition_count);
} else {
do_transition = current_transition;
}
document.images.slide.style.filter=transitions[do_transition];
document.images.slide.filters[0].Apply();
}
document.slide.src = images[current_location].src;
setCaption(photo_captions[current_location],photo_comment[current_location],photo_user_epic_comment[current_location]);
if (browserCanBlend) {
document.images.slide.filters[0].Play();
}
return 1;
}
function preload_photo(index) {
if (pics_loaded < photo_count) {
if (!images[index]) {
images[index] = new Image;
images[index].onLoad = preload_complete();
images[index].src = photo_urls[index];
pics_loaded++;
}
}
}
function setCaption(text,comment,user_comment) {
changeElementText("caption", "Picture " + current_location + " of " + photo_count + " ");
}
</script>
<form name='smigform'>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<div class="headline"><?php echo $headline ?></div>
<script language="JavaScript">
document.write("<font class='pixcount' id='caption';></font>");
</script>
</div>
</td>
<td> </td>
</tr>
<tr>
<td colspan="2">
<div class="navigation">
<div class="navitext" style="width:60px;"><a href='#' onClick='back(); return false;'><img src="<?php echo $include; ?>preview.png" border="0" /></a></div>
<div class="navitext" style="width:110px;"><a href='#' onClick='stopOrStart(); return false;'><span id='stopOrStartText'>Start Slideshow</span></a></div>
<div class="navitext" style="width:60px;"><a href='#' onClick='next(); return false;'><img src="<?php echo $include; ?>next.png" border="0" /></a></div>
<div class="navitext" style="width:60px;"><a href='#' onClick='changeDirection(); return false;'><span id='changeDirText'></span></a></div>
<div style="float:left;">
<span id="time">
<script language="JavaScript">
if (!browserCanBlend) {document.write("<select name='time' onchange='play()'><option value='1'> 1 Second<option value='2'> 2 Seconds<option value='3' selected> 3 Seconds<option value='5' > 5 Seconds<option value='10'> 10 Seconds</select>"); }
</script>
</span>
<span id="fading"></span> </div>
<div><a href='#' onClick='changeDirection(); return false;'><span id='changeDirText'></span></a></div>
</div> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center">
<script language="JavaScript">
document.write("<a href='javascript:weiter()'><img src="+photo_urls[1]+" name='slide' class='photostyle'></a>");
</script></td>
<td> </td>
</tr>
<tr>
<td align="left">
<a href="http://dl.pixary.net" target="_blank"><img src="http://dl.pixary.net/slideme.gif" border="0" /></a>
</td>
<td align="right" class="photosby"><?php echo $photosby ?></td>
<td> </td>
</tr>
</table>
<script language="Javascript">
setCaption(photo_urls[1]);
</script>
</form>
</body>
</html>