![]() |
| ||
| displaying random images I have this code which display random images from any folder on a webserver. You just have to give each picture the same name but with a number at the end of it (make foo.bar foo1.bar footype.bar foo2.bar). Does anybody have any idea how to make this work accept not have any numbers or have the same name on the pictues. I just want it to display any picture in that folder in the webserver regardless of the name. Here is the code. <?php |
| ||
| Re: displaying random images ok, I suggest doing something like this: <?php This means that all is needed is just a number for your images rather then having to name them all. |
| ||
| Re: displaying random images what if the images don't have a number? |
| ||
| Re: displaying random images well the whole idea of the script that you have is that it generates the random image through a random number generator in php based on the numbers used to name your images. Therefore using your script you must have numbered images. This is pretty much the easiest way in generating your random images. If you do not understand the script you are using i suggest going to www.tizag.com and reading up on some php. |
| ||
| Re: displaying random images You could also just store the image names in an array and refer to the array with the number. An example is the following. <?phpVery basic and hope it does the job. |
| ||
| Re: displaying random images arrays is a good idea, but then requires alot of manuel work, of constantly updating the code when there is a new image. Unless you do it atuomaticaly but your script does not support that. |
| ||
| Re: displaying random images Quote:
|
| ||
| Re: displaying random images Thank you for you input cwarn23. That solution did work for me. And Im doing something in Javascript which is very similar excepts it fades through images, and I think I am going to use the same concept. Thanks again. |
| All times are GMT -4. The time now is 8:54 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC