Jump to content

Archived

This topic is now archived and is closed to further replies.

Gruzin

Need some help with Pictures

Recommended Posts

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].'" />'; ?>

Share this post


Link to post
Share on other sites
[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

Share this post


Link to post
Share on other sites
no, it doesn't display any picture, god I'am tired... what can I do to fix that?

Share this post


Link to post
Share on other sites
yes a box with red cross, what's going on? please help...

Share this post


Link to post
Share on other sites
nothing,
here is the address:

http://www.3d.caucasus.net/test/index.php

Share this post


Link to post
Share on other sites
Ok, well basically this picture:
http://www.3d.caucasus.net/pics/robo.jpg

Because 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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.