Jump to content

Recommended Posts

I was told that you guys could probably help me with this, so heres my situation. I use this program called Activeworlds, and me and my buddies are makeing a "tv show" if you will within the program. To do so, you take screenshots, save the screenshots, and add the image files into a directory on your domain. You need a .php script to present them as a slideshow. Now the problem is, ive searched for scripts already made from other sites, but the thing is, they are all fancy slideshow viewers, meaning they come with control buttons to cycle through the pictures and all kinds of other banners and flashy looking things. The only script im needing, is a simple script that will display and cycle through the raw images, and nothing else, within the web browser, in a slideshow format. Id also like to have a value I can edit that will change how fast the pictures cycle through, 15 seconds or so would be perfect however. If someone could refer me to this code or even make it for me, it would be soo appreciated. I know im probably asking for alot, but it would help me soo much. I wish I knew a little more about .php files to do it myself, or else I would. If you do link me to a script, please give me simple instructions on what to do with it lol because like I said, I dont know anything about the world of .php yet. Thank you all for your time.

PHP won't be able to change the image without some user interaction (IE hitting a next button or something). To have the images changed on the fly without the user doing anything, you would need some kind of client side code, like javascript. The Jquery library would make this process fairly simple if you wanted to learn about it.

Jquery intro: http://docs.jquery.com/How_jQuery_Works

Javascript Intro: http://www.tizag.com/javascriptT/

 

But i'm feeling generous today. I'll see if I can whip up something for you real fast. Give me a few minutes.

Thank you, I hate to feel useless but this is soo over my head. I will deffinately read more into this. To have the knowledge to just "whip something up" would make my life soo much better lol.. Where should I start if im trying to read up on this stuff. I started a .php tutorial, but its already over my head so Im guessing thats not where I should start out.

OK, this is pretty well documented so it should kind of explain itself.

 

<!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=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery.js"></script>

</head>

<body>
<script type="text/javascript">
function slideSwitch() {
//select the active image
    var active = $('#slideshow IMG.active');
//select the next image in line
    var next = active.next();    

    next.addClass('active');
    active.removeClass('active');
//active.css("display", "none");//hide the inactive one
//next.css("display", "inline");//show next one
        //this adds some simple animation. comment out next to lines, and uncomment previous lines if you want to just 
active.fadeOut("slow");
next.fadeIn("flow");

}

$(function() {
//variable to set how fast to switch in seconds
secs = 1//set this to how many secs you want
//this sets the slideSwitch() function to run every secs seconds
    setInterval( "slideSwitch()", secs * 1000 );
});

</script>

<?php
$path = "images/";//path to the directory with the images change this to your path
//this script assumes the directory has nothing but images
//which will allow us to simply select everything in the directory
$images = glob($path."*.*");
//now we basically put all our images
echo "<div id='slideshow' >";
foreach($images as $key=>$image){
if ($key == 0){
	//here we just show the image
	echo "<img src='".$image."' class='active' />";
}
else {
	//here we echo the image, but set it to display none style so it wont be rendered
	echo "<img src='".$image."' style='display:none' />";
}
}
echo "</div";
?>
</body>
</html>

 

But It basically gets the images in an array, outputs them into a div with an id of slideshow, and the javascript switches each image. However, this is a very simple script. It goes through all the images and once it gets to the end, the screen is blank.

 

As for learning, PHP is actually a pretty good place to start, assuming you know HTML

 

HTML intro: http://www.tizag.com/htmlT/

PHP Intro: http://www.php.net/manual/en/intro-whatis.php

 

let me know if you have further problems

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.