I need to mention: I already have the images for random backgrounds.. I mean to upload them to styles folder and randomly applying them.
Not working at all..Sniper_E wrote: ↑Sat May 11, 2019 5:29 am I once created a directory, theme/images/bg.gif/ directory named bg.gif
I put all of my bg images in that directory and found a rotate.php file to put in there.
I renamed the rotate.php to index.php and it randomly selected an image in same directory.
In the colours.css I used "./images/bg.gif" for the background image.
This would work better in an extension. There should be a few out there.
Code: Select all
<img src="{ROOT_PATH}styles/we_universal/theme/images/dashboard.jpg?assets_version={T_ASSETS_VERSION}" alt="forum header image">
I downloaded we_universal again and installed it.
New folder
directory to dashboard.jpg
Code: Select all
<?php
/*
By Matt Mullenweg > http://photomatt.net
Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php
Latest version always at:
http://photomatt.net/scripts/randomimage
*/
// Make this the relative path to the images, like "../img" or "random/images/".
// If the images are in the same directory, leave it blank.
$folder = '';
// Space seperated list of extensions, you probably won't have to change this.
$exts = 'jpg jpeg png gif';
$files = array(); $i = -1; // Initialize some variables
if ('' == $folder) $folder = './';
$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) { // for each extension check the extension
if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
$files[] = $file; // it's good
++$i;
}
}
}
closedir($handle); // We're not using it anymore
mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
$rand = mt_rand(0, $i); // $i was incremented as we went along
header('Location: '.$folder.$files[$rand]); // Voila!
?>
It's worth explaining which background you're talking about.ivailo95 wrote: ↑Sun May 12, 2019 2:21 pm omg..i want the same think here..
viewtopic.php?f=496&t=2509346 , but no one look into this topic and now i suspect same topic wow
now talk in topic: how can i do this , i mean to change background at every refresh
i made some edit in my topic
Impossible to rename a directory to dashboard.jpg :/Sniper_E wrote: ↑Sat May 11, 2019 6:08 pmI downloaded we_universal again and installed it.
The image path was exactly as Robert stated above.
I went into the theme/images/ directory and created a "New folder"
Then I moved the images, dashboard.jpg and dashboard-FCF.jpg into the New folder directory.
After that I renamed theNew folder
directory todashboard.jpg
Then I placed the index.php file in that directory with the images.
It worked great!
This is the random image codes in the index.phpCode: Select all
<?php /* By Matt Mullenweg > http://photomatt.net Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php Latest version always at: http://photomatt.net/scripts/randomimage */ // Make this the relative path to the images, like "../img" or "random/images/". // If the images are in the same directory, leave it blank. $folder = ''; // Space seperated list of extensions, you probably won't have to change this. $exts = 'jpg jpeg png gif'; $files = array(); $i = -1; // Initialize some variables if ('' == $folder) $folder = './'; $handle = opendir($folder); $exts = explode(' ', $exts); while (false !== ($file = readdir($handle))) { foreach($exts as $ext) { // for each extension check the extension if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive $files[] = $file; // it's good ++$i; } } } closedir($handle); // We're not using it anymore mt_srand((double)microtime()*1000000); // seed for PHP < 4.2 $rand = mt_rand(0, $i); // $i was incremented as we went along header('Location: '.$folder.$files[$rand]); // Voila! ?>
dashboard.jpg
in the folder where your directory (folder) is placed?If you want to leave the original images in the images/ directory, then name your new folder to sunshine.jpg