karlo 0 Report post Posted February 25, 2005 First, It's really confusing. Do you know any tutorials on Image Manipulation on PHP? Here's another simple one: 1. Create a 5 image. 2. Rename them to something like: image1.jpg; image2.jpg; and so on... 3. Create your PHP file (rotation.php) 4. Enter the following code: <?phpheader("content-type: image/jpeg");readfile("image".mt_rand(1,3).".jpg");?> 5. Execute your script. Share this post Link to post Share on other sites
Dragonfly 0 Report post Posted February 25, 2005 Could you please a little bit more elaborate. I'm interested in using this script. where do I keep the images and also file path is not mentioned clearly. Please... Share this post Link to post Share on other sites
rejected 0 Report post Posted February 25, 2005 You save the images in the directory as the rotation is in. Share this post Link to post Share on other sites
karlo 0 Report post Posted February 25, 2005 You save the images in the directory as the rotation is in. 53798[/snapback] Yes. Or you can change it... example "images/rotate/ads/image" Share this post Link to post Share on other sites
egbakaet 0 Report post Posted February 25, 2005 Here's an even easier way, if that's too complicated. lol. <? $show = 2; //change 5 to number of buttons you want to show $button[] = "|-img code here-|";$button[] = "|-img code here-|"; //and so on srand ((float) microtime() * 10000000); $Keys = array_rand($button, 3); //change 5 to number of buttons you want to show for($K = 0; $K < $show; $K++){ echo "".$button[$Keys[$K]].""; } ?> Just add more lines of $button[] = "|-img code here-|"; to the code to make more images! Hope that helps! Share this post Link to post Share on other sites
karlo 0 Report post Posted February 26, 2005 Here's an even easier way, if that's too complicated. lol. <? $show = 2; //change 5 to number of buttons you want to show $button[] = "|-img code here-|";$button[] = "|-img code here-|"; //and so on srand ((float) microtime() * 10000000); $Keys = array_rand($button, 3); //change 5 to number of buttons you want to show for($K = 0; $K < $show; $K++){ echo "".$button[$Keys[$K]].""; } ?> Just add more lines of $button[] = "|-img code here-|"; to the code to make more images! Hope that helps! 54119[/snapback] It's more difficult! Especially in using Arrays! http://forums.xisto.com/topic/7711-confused-some-php-functions-that-i-am-confused/ Share this post Link to post Share on other sites
chiclete 0 Report post Posted February 26, 2005 I got this image rotator: <?php// 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 = 'fotos/banner/';// Space seperated list of extensions, you probably won't have to change this.$exts = 'jpg jpeg png gif';$files = array(); $i = -1; // Initialize some variablesif ('' == $folder) $folder = './';$handle = opendir($folder);$exts = explode(' ', $exts);while (false !== ($file = readdir($handle))) { foreach($exts as $ext) { // for each extension check the extension if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive $files[] = $file; // it's good ++$i; } } }closedir($handle); // We're not using it anymoremt_srand((double)microtime()*1000000); // seed for PHP < 4.2$rand = mt_rand(0, $i); // $i was incremented as we went alongheader('Location: '.$folder.$files[$rand]); // Voila!?> It's working but I wanted it to make a .jpg file not a .php so I could put it on a forum... do you guys know if I can do it? Share this post Link to post Share on other sites