The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Random Image Forum Side Block?
I'm looking for code that will go to a designated directory "/images/ads/sideblock" and grab like 4 or 5 images and place them randomly there.
I found this code and tried to use it as php on a sideblock but I got an error. I'm not a codr so I though I'd ask you guys that are... Any help would be awesome... Thanks... Code:
<?php // Configuration $image_path = ""; $types = array( "GIF" => "image/gif", "JPG" => "image/jpg", "PNG" => "image/png"); // Directory scan $file_list = array(); $image_path = realpath(trim($image_path) != "" ? $image_path : ".") . "/"; if ($image_path !== false && is_dir($image_path) && $handle = @opendir($image_path)) { while (($file = readdir($handle)) !== false) { if (is_file($image_path . $file)) { $file_extension = strtoupper(substr(strrchr($file, "."), 1)); if (isset($types[$file_extension])) { $file_list[] = array( "filename" => $image_path . $file, "mimetype" => $types[$file_extension]); } } } } // Output if (sizeof($file_list) > 0) { shuffle($file_list); header("Content-Type: " . $file_list[0]["mimetype"]); header("Content-Length: " . @filesize($file_list[0]["filename"])); @readfile($file_list[0]["filename"]); } else { die("No images found."); } ?> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|