Gruzin Posted July 19, 2006 Share Posted July 19, 2006 hi, I want to display pictures in random why, so here is my effort:<?php//array to hold the pictures$imageArr= array();$imageArr[1] = "/pics/fish.jpg";$imageArr[2] = "/pics/robo.jpg";$imageShow = rand(1, count($imageArr));?>//display the pictures in random way<?php echo '<img src="'.$imageArr[$imageArr].'" />'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/ Share on other sites More sharing options...
chrisprse Posted July 19, 2006 Share Posted July 19, 2006 [code=php:0]<?php$imageArr = array();$imageArr[] = "pics/fish.jpg";$imageArr[] = "pics/robo.jpg";$randomImage = array_rand($imageArr);echo '<img alt="" src="'.$imageArr[$randomImage].'">';?>[/code]hth Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60434 Share on other sites More sharing options...
Gruzin Posted July 19, 2006 Author Share Posted July 19, 2006 no, it doesn't display any picture, god I'am tired... what can I do to fix that? Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60436 Share on other sites More sharing options...
GingerRobot Posted July 19, 2006 Share Posted July 19, 2006 What does it display? A box with the red cross or nothing at all? Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60437 Share on other sites More sharing options...
Gruzin Posted July 19, 2006 Author Share Posted July 19, 2006 yes a box with red cross, what's going on? please help... Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60442 Share on other sites More sharing options...
chrisprse Posted July 19, 2006 Share Posted July 19, 2006 Check the image paths first of all... What does the source say? Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60444 Share on other sites More sharing options...
Gruzin Posted July 19, 2006 Author Share Posted July 19, 2006 nothing,here is the address:http://www.3d.caucasus.net/test/index.php Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60446 Share on other sites More sharing options...
GingerRobot Posted July 19, 2006 Share Posted July 19, 2006 Ok, well basically this picture:http://www.3d.caucasus.net/pics/robo.jpgBecause it is in the /test/ subdirectory. chnge the code to the following:[code]<?php$imageArr = array();$imageArr[] = "/pics/fish.jpg";$imageArr[] = "/pics/robo.jpg";$randomImage = array_rand($imageArr);echo '<img alt="" src="'.$imageArr[$randomImage].'">';?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60450 Share on other sites More sharing options...
Gruzin Posted July 19, 2006 Author Share Posted July 19, 2006 Thank a lot:) Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60458 Share on other sites More sharing options...
willfitch Posted July 19, 2006 Share Posted July 19, 2006 Gruzin, I thought we fixed this issue yesterday on a different post. You should not start a new post if there is one open; especially if they arrive to the same conclusion. Quote Link to comment https://forums.phpfreaks.com/topic/15031-need-some-help-with-pictures/#findComment-60538 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.