Jump to content


Photo

Need some help with Pictures


  • Please log in to reply
9 replies to this topic

#1 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 19 July 2006 - 12:55 PM

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].'" />'; ?>
I don't need your script, I'll try to write it myself

#2 chrisprse

chrisprse
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationUnited Kingdom

Posted 19 July 2006 - 01:04 PM

<?php
$imageArr = array();
$imageArr[] = "pics/fish.jpg";
$imageArr[] = "pics/robo.jpg";

$randomImage = array_rand($imageArr);

echo '<img alt="" src="'.$imageArr[$randomImage].'">';

?>

hth

#3 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 19 July 2006 - 01:08 PM

no, it doesn't display any picture, god I'am tired... what can I do to fix that?
I don't need your script, I'll try to write it myself

#4 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 19 July 2006 - 01:09 PM

What does it display? A box with the red cross or nothing at all?

#5 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 19 July 2006 - 01:14 PM

yes a box with red cross, what's going on? please help...
I don't need your script, I'll try to write it myself

#6 chrisprse

chrisprse
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationUnited Kingdom

Posted 19 July 2006 - 01:24 PM

Check the image paths first of all... What does the source say?

#7 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 19 July 2006 - 01:32 PM

nothing,
here is the address:

http://www.3d.caucas.../test/index.php
I don't need your script, I'll try to write it myself

#8 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 19 July 2006 - 01:37 PM

Ok, well basically this picture:
http://www.3d.caucas...t/pics/robo.jpg

Because it is in the /test/ subdirectory. chnge the code to the following:

<?php
$imageArr = array();
$imageArr[] = "/pics/fish.jpg";
$imageArr[] = "/pics/robo.jpg";

$randomImage = array_rand($imageArr);

echo '<img alt="" src="'.$imageArr[$randomImage].'">';

?>


#9 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 19 July 2006 - 01:52 PM

Thank a lot:)
I don't need your script, I'll try to write it myself

#10 willfitch

willfitch
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts
  • LocationNew Hope, PA

Posted 19 July 2006 - 04:31 PM

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.
Zend Certified Engineer (ZEND001989)
www.willfitch.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users