Computer Science Canada Random images? |
Author: | Corybu [ Sat Oct 04, 2003 4:57 pm ] |
Post subject: | Random images? |
Anyone know how to display random images? Ive got a website that I need to make for a friends band, and I have various logos that i'd like to place in a frame in the top left corner. If anyone could tell me how this os done, or point me to t autorial for it, or give me a code/script for it, Id be very grateful. Thanking you all in advance, Cory. |
Author: | Blade [ Sat Oct 04, 2003 5:09 pm ] |
Post subject: | |
well... you'd have to use some sort of scripting language... ie: perl, php etc. |
Author: | Corybu [ Sat Oct 04, 2003 5:10 pm ] |
Post subject: | |
I dont know either of those.... Could you or someone here help me out with this one? I was hoping there was an html way... |
Author: | Blade [ Sat Oct 04, 2003 5:14 pm ] |
Post subject: | |
no... html is pretty much tags that format text, it cant caculate anything well... i'd read the images from a folder into an array, then use a random integer in the array element from 1 to the amount of pictures in the array, then use html to present it... |
Author: | Corybu [ Sat Oct 04, 2003 5:15 pm ] |
Post subject: | |
Lol... I dont get it. Do all that stuff with html? or another script? Ive never done any scripting... |
Author: | Amailer [ Sat Oct 04, 2003 5:24 pm ] | ||
Post subject: | |||
PHP:
Javascript: http://javascript.internet.com/bgeffects/r-images.html http://www.google.ca/search?hl=en&ie=UTF-8&oe=UTF-8&q=Javascript%3A+random+images+script&btnG=Google+Search&meta= |
Author: | Corybu [ Sat Oct 04, 2003 5:26 pm ] |
Post subject: | |
So, with that, I just put it on the html page where I want it to appear, and put the pics in a directory all by themselves? |
Author: | Amailer [ Sat Oct 04, 2003 5:27 pm ] |
Post subject: | |
Which one you are talking about? |
Author: | Corybu [ Sat Oct 04, 2003 5:27 pm ] |
Post subject: | |
the php script |
Author: | Amailer [ Sat Oct 04, 2003 5:30 pm ] | ||
Post subject: | |||
1: you need php installed, create a .php file (i.e: randomeimg.php ) put the script in, and add afer that
|
Author: | Blade [ Sat Oct 04, 2003 5:31 pm ] | ||
Post subject: | |||
what amailer gave you as a function... this is the most simple way you can do it... its php... you need a server that supports php to use it, and you also need ot name your file .php instead of .htm/.html ... or else the server wont execute it.. you can see it working at http://dblade.sytes.net/new/readdir.php what it does is it reads the folder /images (which is in my new folder on the server) that is full of images, into an array.. then it gets a random number between 2 (because the first two it reads is . and .. ) and the maximum number of images in the folder, then you use the random number in the array to call a random array element ie: $arrayname[randomnumber] |
Author: | Corybu [ Sat Oct 04, 2003 5:31 pm ] |
Post subject: | |
Im assuming I need some kind of software installed to run PHP then? This site isnt getting hosted on a private server... its just going on free webhosting... Ill have to see if it can use php... |
Author: | Blade [ Sat Oct 04, 2003 5:33 pm ] |
Post subject: | |
umm... the server you're using needs to have php for you to use php... theres only a couple free server that i know of that have php... tripod.co.uk and host.sk (which isnt in english) |
Author: | Corybu [ Sat Oct 04, 2003 5:35 pm ] |
Post subject: | |
I see... Well, as long as its free, I can probably have the site hosted there... Ill just get redirect service for it. Thanks for the help guys. |
Author: | Amailer [ Sat Oct 04, 2003 5:36 pm ] |
Post subject: | |
better if you use the JAVASCRIPT ONE, cuz you don't have PHP |
Author: | Blade [ Sat Oct 04, 2003 5:38 pm ] |
Post subject: | |
i never think of javascript cuz its evil.... (not a real fan of java or javascript...) |
Author: | Corybu [ Sat Oct 04, 2003 11:32 pm ] |
Post subject: | |
Anyone wanna tell me the Java(script) one? My boss at work said he would find it and give it to me, but I wont see him till friday at the earliest, I want to have something to show my client (hahaha, feels so cool to call somone that) for monday. So, any help would roxorz, lol. |
Author: | Amailer [ Sat Oct 04, 2003 11:53 pm ] |
Post subject: | |
http://dblade.sytes.net/new/images/frozencavern.jpg http://dblade.sytes.net/new/images/Gohan-The_Son_of_Goku.jpg http://dblade.sytes.net/new/images/likwidassassin.jpg ahh awsome! |
Author: | Corybu [ Sat Oct 04, 2003 11:55 pm ] |
Post subject: | |
Is that blades? (url is dblade.something.somethingelse) Its nice. (note to blade, 666 posts!!! AAHHHHHH!!!!!! ) lol. |