PHP | Random Images Doesn't Work?

Baseball Freak

New member
I have this snippet of code that is supposed to display a random image each time:

<?php

$url = array('URL1',
'URL2',
'URL3',
'URL4');

$random = rand(1,count($url));

$imagepath = $url[$random];

$image = imagecreatefromgif($imagepath);

header('Content-Type: image/gif');

imagegif($image);

?>

It will display every image except for URL1.

Help with this?
 
Back
Top