View Full Version : TRUE Random Image Script Assistance Needed...

02-15-2012, 04:36 PM
hi there,

i haven't posted much before and am INCREDIBLY new to coding. i am going to try my best to be clear and concise (to get the best help of course).

i am building a website where i would like the main page to randomly choose of ALL images i have in a database and create a nice stream. on reload or revisit, i would like this stream to again be random. i would like each image in the stream to act as a link to the page/series it is apart of and i would of course like some sort of control as far as page formatting and size. (for different resolutions)

that being said, i am basing this all on the follow site that i found. i am NOT copying the site, but the images reload is seamless and beautiful: The Site (http://antondemin.ru/)

i have viewed his source and i have viewed his .js and his .css and i cannot find a single thing that shows me how he did it. i feel like i am going crazy.

Resource Links:

The Stylesheet (http://antondemin.ru/style.css)

The Javascript S/he uses. (http://antondemin.ru/box.js)

thank you for any and all help regarding this.


02-15-2012, 08:57 PM
The randomizing with a db is more than html and css, you'll need php and mysql. As far as what Anton's site is doing, it looks like pages with a simple scroller that overflows off the page and utilizes a light box when you click an image, nothing spectacular. If you're incredibly new to coding, I wouldn't recommend tackling a project like this, start off with something smaller or by getting the different components of the site working separately, then eventually start combining them. Get a scroller to work like Anton's, then implement a light box, then add in the randomization with javascript, or php and database script. Baby steps.

02-15-2012, 09:00 PM
Trying to export the data from a database in random order is very inefficient. The best place to change the order to random would be in the PHP. Simply load all the references to the images into an array and then Shuffle the array so as to get them in random order. Then attach them into the page in their arreay order. You may also need to pass that array to JavaScript so that it can do the appropriate swaps after the page has loaded.