Help - Search - Members - Calendar
Full Version: Random Image Everytime You Refresh
Forums > Resource Center > Webmasters' Corner > Webmasters' Corner Resolved Topics
Keeper-Of-Keys
I have a Piczo website and I wish to place a html code for displaying random images everytime I refresh my page. How do you do this?
hermes
try to play with the script in this tutorial
Keeper-Of-Keys
Thanks, I will!
hermes
forgot to tell you that the script is for ads, so just try to remove the url line and see if it works
Fawaz
If you don't want to use javascript for that you can use php which is better.

Here is the simpliest way that I could thing ok.

Must be a .PHP File
CODE
<?php
// linking to the images that you want to display.
// feel free to edit within the single quotes ''
$images = array(
'http://farm1.static.flickr.com/175/428230889_3b3994a0b9_m.jpg',
'http://farm2.static.flickr.com/1371/1008816651_22d46ee2d1_m.jpg',
'http://farm4.static.flickr.com/3121/2765637403_268188b4a7_m.jpg',
'http://farm4.static.flickr.com/3008/2611822886_ee757ee4ed_m.jpg',
'http://farm1.static.flickr.com/1/2998240_18286b2677_m.jpg'

);

// printing out the image.
echo "<img src=\"" . $images[array_rand($images)] . "\" alt=\"\" />";
?>


You can add as many images as you want.
Make sure you add the comma , after all except the last one.

Edit: I don't no if Piczo allow php.
Keeper-Of-Keys
QUOTE(Fawaz @ Jul 3 2009, 08:22 AM) *
If you don't want to use javascript for that you can use php which is better.

Here is the simpliest way that I could thing ok.

Must be a .PHP File
CODE
<?php
// linking to the images that you want to display.
// feel free to edit within the single quotes ''
$images = array(
'http://farm1.static.flickr.com/175/428230889_3b3994a0b9_m.jpg',
'http://farm2.static.flickr.com/1371/1008816651_22d46ee2d1_m.jpg',
'http://farm4.static.flickr.com/3121/2765637403_268188b4a7_m.jpg',
'http://farm4.static.flickr.com/3008/2611822886_ee757ee4ed_m.jpg',
'http://farm1.static.flickr.com/1/2998240_18286b2677_m.jpg'

);

// printing out the image.
echo "<img src=\"" . $images[array_rand($images)] . "\" alt=\"\" />";
?>


You can add as many images as you want.
Make sure you add the comma , after all except the last one.

Edit: I don't no if Piczo allow php.


I'll try this. Thank you!
PaigeTurner
Hermes, I LOVE your icon! oro.gif
Beenly
QUOTE(PaigeTurner)
Hermes, I LOVE your icon! oro.gif

this.
Mikeplyts
uh, this should be closed.



it just got irrelevant. >_>
Mike
Right. Keeper-Of-Keys, PM me if you need this reopened. Topic closed & moved.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.