MyBB Community Forums
Is there a plugin that allow a new logo per refresh? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Is there a plugin that allow a new logo per refresh? (/thread-204772.html)



Is there a plugin that allow a new logo per refresh? - day-day - 2016-10-08

Is this possible? New logo/header image per refresh?


RE: Is there a plugin that allow a new logo per refresh? - Phumix - 2016-10-10

Not as I know, you could mess around with some basic HTML and JS.
Have a look at this http://stackoverflow.com/questions/9700986/how-to-change-the-image-when-a-page-is-refreshed-using-javascript


RE: Is there a plugin that allow a new logo per refresh? - Neeeeeeeeeel.- - 2016-10-13

Create a logo.php on your public root directory
<?php 
$logos = Array();
if ($dir = opendir('images/custom_logos')){
	while (false !== ($file = readdir($dir))){
		if (!preg_match("/\.png$/i", $file)){
			continue;
		}
		$logos[] = $file;
	}
	closedir($dir);
}

if (count($logos) > 0){
	$rand = rand(0, count($logos)-1);
	$logo = $logos[$rand];
	header('Content-Type: image/png');
	echo file_get_contents("images/custom_logos/{$logo}");
}
?>

Then, in your .htacccess
RewriteEngine On
RewriteBase /
RewriteRule ^images\/logo\.png logo.php [L,QSA,NC]

You should save all your logos at "images/custom_logos" in png format.

Then point your forum logo to

http://YOURSITE.COM/images/logo.png