wing. Posted June 28, 2004 Share Posted June 28, 2004 i was wondering how would i go about making image's rotate using php (basically tell me but dont post any code i want to make it myself) thanks :ninja: Link to comment Share on other sites More sharing options...
0 wing. Posted June 28, 2004 Author Share Posted June 28, 2004 any 1? Link to comment Share on other sites More sharing options...
0 red8Rain Posted June 28, 2004 Share Posted June 28, 2004 yes yes you can. It require the use of an array. Link to comment Share on other sites More sharing options...
0 wing. Posted June 28, 2004 Author Share Posted June 28, 2004 just an array? Link to comment Share on other sites More sharing options...
0 Zetter Posted June 28, 2004 Share Posted June 28, 2004 I used a random script, first images are listed in an array, then a random number is generated, and lastly an image is chosen depending on the number using if > or < statments. Link to comment Share on other sites More sharing options...
0 mikey Posted June 28, 2004 Share Posted June 28, 2004 i'd stuck the urls of images in an array, use the choose a random number of array function (array_rand() :ninja: ) and then echo ( :ninja: ) the one that it choses! Link to comment Share on other sites More sharing options...
0 Post-It Note Posted June 28, 2004 Share Posted June 28, 2004 What type of rotation are you talking about? Like, rotate the picture 90 degrees to the right, or like show picture 1, then 2, 3, 4 etc.? Link to comment Share on other sites More sharing options...
0 wing. Posted June 28, 2004 Author Share Posted June 28, 2004 hmmm... all i wanted was to display was to display one image then move on to the next and so on until it got to the "end" and went back to the start thanks zetter btw and IPv6 Link to comment Share on other sites More sharing options...
0 AllCdnBoy Posted June 28, 2004 Share Posted June 28, 2004 that's not exactly random Link to comment Share on other sites More sharing options...
0 wing. Posted June 28, 2004 Author Share Posted June 28, 2004 that's not exactly random ;) i didnt ask for random Link to comment Share on other sites More sharing options...
0 matt74441 Posted June 28, 2004 Share Posted June 28, 2004 You can use either an array or just a random number. Heres how I used to do my random sigs: With an associative array: <? //Associative array. Holds an integer value for each file name. $array = array( 1 => 'sig1.jpg', 2 => 'sig2.jpg', 3 => 'sig3.jpg', 4 => 'sig4.jpg'. 5 => 'sig5.jpg', 6 => 'sig6.jpg', 7 => 'sig7.jpg' ); //Creates the random number based on the number of images in the array. $random = mt_rand(1,7); //Sets the image name. $image = "$array[$random]"; //Displays the image. header("Location: $image"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); // always modified header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 ?> With just a random number: <? $lower = 1; $upper = 7; $random_number = mt_rand($lower, $upper); $image = "$random_number.jpg"; header("Location: $image"); ?> With this one, you just number all of the images you want rotated. Link to comment Share on other sites More sharing options...
0 wing. Posted June 28, 2004 Author Share Posted June 28, 2004 You can use either an array or just a random number. Heres how I used to do my random sigs:With an associative array: <? //Associative array. Holds an integer value for each file name. $array = array( 1 => 'sig1.jpg', 2 => 'sig2.jpg', 3 => 'sig3.jpg', 4 => 'sig4.jpg'. 5 => 'sig5.jpg', 6 => 'sig6.jpg', 7 => 'sig7.jpg' ); //Creates the random number based on the number of images in the array. $random = mt_rand(1,7); //Sets the image name. $image = "$array[$random]"; //Displays the image. header("Location: $image"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); // always modified header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 ?> With just a random number: <? $lower = 1; $upper = 7; $random_number = mt_rand($lower, $upper); $image = "$random_number.jpg"; header("Location: $image"); ?> With this one, you just number all of the images you want rotated. :ninja: sorry but i said post no code :p its cool anyway will work on it see what happens post any errors Link to comment Share on other sites More sharing options...
0 matt74441 Posted June 28, 2004 Share Posted June 28, 2004 Oh I'm sorry. My bad :p Link to comment Share on other sites More sharing options...
0 metal_dragen Veteran Posted June 28, 2004 Veteran Share Posted June 28, 2004 So you don't really want a rotator, you want a slideshow. In that case, use Javascript - PHP is server side and every time the image changes would require another request for the page from the server. Link to comment Share on other sites More sharing options...
Question
wing.
i was wondering how would i go about making image's rotate using php
(basically tell me but dont post any code i want to make it myself)
thanks :ninja:
Link to comment
Share on other sites
13 answers to this question
Recommended Posts