NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

Post a reply

Write your message and submit
Options
Humanity test

What is ten + six?

Go back

Topic review (newest first)

AlkseeyaKC
03-30-2008 11:40:24

IT WORKS NOW!!! Thank you soooo much Trunksi and Waccoon! <3

Waccoon
03-30-2008 03:47:32

The bug is in this line:

Code:

if ('http://oekamie.divagate.com/BGs/' == $folder) $folder = './';

This line will compare the hard-coded path to $folder, and find them to be identical, so it sets the folder path to ./ instead of what we want, which is ./BGs/.  The reason why you get a Java button is because the script is serving the image files from the root folder, instead of the ./BGs/ folder.

Here's the full script (with a few tweaks).  It's easier to use relative paths, anyway:

Code:

<?php
/*
    By Matt Mullenweg > http://ma.tt
    Tweaked a bit by Waccoon
    Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php
    Latest version always at:
    http://ma.tt/scripts/randomimage/
*/


// -- CONFIG --

// Make this the relative path to the images, like "../img" or "random/images/".
// If the images are in the same directory, leave it blank.
$folder = './BGs/';

// Array of extensions, all lower case.
// You probably won't have to change this.
$exts = array('jpg', 'jpeg', 'png', 'gif');



// -- DO NOT CHANGE ANYTHING BELOW THIS LINE --

// Verify config
if (!isset($folder) || empty($folder)) {
    $folder = './';
}
if (!isset($exts) || empty($exts)) {
    $exts = array('jpg', 'jpeg', 'png', 'gif');
}

// Open the directory
$files = array();
$handle = opendir($folder);
while (false !== ($file = readdir($handle))) {
    foreach($exts as $ext) {
        // for each extension, check the extension
        if (strpos(strtolower($file), '.'.$ext) !== false) {
            $files[] = $file; // it's good
        }
    }
}
closedir($handle); // We're not using it anymore

$i = count($files);
if ($i > 0) {
    mt_srand( (double) microtime() * 1000000); // seed for PHP < 4.2
    $rand = mt_rand(0, count($files));

    header('Location: '.$folder.$files[$rand]); // Voila!
}
exit();

?>
AlkseeyaKC
03-29-2008 23:40:51

LOL there instructions are not user friendly. I don't understand if I should be or were I should be changing stuff or where it goes! X_x;;

I made a BG.php file:
http://i6.photobucket.com/albums/y212/AlkseeyaKC/Picture7-1.png

and I added this to my template:
http://i6.photobucket.com/albums/y212/AlkseeyaKC/Picture5.png

What am I doing wrong! >_<;;;?

EDIT: I don't know how or why, But I have a java button were the banner should be. O_o
I'm going to keep messing with it, I think I'm getting closer some how. XD

Edit: nope not working. I realized that I think I need the .php in the same folder. So I put it in with the BGs.  But I still don't know why its not working. =/

Trunksi
03-29-2008 13:51:59

I always used this one:
http://ma.tt/scripts/randomimage/

I'm not sure if the code is a good one (I hope it's trustworthy... lol) ... but it worked for me tongue
and the best: you don't have to name every picture
just put it in that folder is enough


So I saved this as a php-file and putting a simple <img>-code in the banner-box big_smile

AlkseeyaKC
03-29-2008 12:46:05

I have been using this site that makes images random for you so you can have one URL for all of them. Example would be http://www.tektek.org/account/signup.vex

But they have not been completely reliable. So I'm trying to work a Java Script in so I don't need to go threw them. But I don't really know what I am doing. XD
I'm trying to use the scripting from http://javascript.internet.com/miscella … image.html

Here is where I'm trying to use it:
http://i6.photobucket.com/albums/y212/AlkseeyaKC/Picture7.png
This is in my template.

http://i6.photobucket.com/albums/y212/AlkseeyaKC/Picture8.png

the image needs to go in the background be hind the logo.

I could just make make the logo part of the background image. to be easy. But I really wanted it centered on all browsers.

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB