Posted By

wireplay on 09/03/10


Tagged

php image random


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

fwd
koyotebr


PHP - Random Image


 / Published in: PHP
 

  1. <?php
  2. //total number of images
  3. $totalimages = "300";
  4. //file type
  5. $file_type = ".jpg";
  6. //location
  7. $image_folder = "../assets/images/";
  8. //start counting from number
  9. $startcounter = "1";
  10. $random = mt_rand($startcounter, $totalimages);
  11. $image_name = $image_folder . $random . $file_type;
  12. ?>
  13. <img src="<?php echo $image_name; ?>" name="image<?php echo $random; ?>" width="" height="" border="0" id="image<?php echo $random; ?>" alt="" />

Report this snippet  

You need to login to post a comment.