Announcement

Collapse
No announcement yet.

Script To Select A Random Image

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script To Select A Random Image

    On my forum, I'd like to make a sig.php for myself and have it randomly select an image to display. What code would be used to do this? I've seen it done before on another vB which is why I wanted to do this as well, but I'm not sure of the coding to use.
    "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
    "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
    Utopia Software - Current Software: Utopia News Pro (news management system)

  • #2
    This should work:
    PHP Code:
    srand ((float) microtime() * 10000000);
    $images = array('./image1.gif''./image2.gif''./image3.gif');
    $rand_image array_rand($images);

    header('Content-type: image/gif');
    readfile($images["$rand_image"]); 
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X