Here's a little hack to display a random logo from a specific folder in your theme's directory (applies only to themes where it exists and contains images).
It's based on custom header file: if you already have set one, probably you won't be able to use this hack.
Basic HTML and CSS knowledge required.
Demo on my site
http://vanrokken.altervista.org/Any comment or suggestion appreciated.
OPEN
themes/your_theme/template.html
FIND
logo image "src" HTML attribute or "background"/"background-image" CSS property of the element containing the logo, e.g. in Classic theme:
<a href="index.php"><img src="themes/classic/images/site_logo.png" border="0" alt="" /></a><br />
in Project VII:
<div style="background-image:url(themes/project_vii/images/top_panel_r1_c1.jpg);background-repeat:no-repeat">
If you can't find any, probably the "background"/"background-image" property of the element containing the logo is set in the element class/id declaration in themes/your_theme/style.css, like in Connections theme:
#header {
background: #FFF url(themes/connections/images/top.jpg) no-repeat bottom;
height: 183px;
margin: 0 auto;
width:760px;
padding:0;
border:#fc9 0px solid;
}
REPLACE
logo image "src" attribute or "background"/"background-image" url path with {CUSTOM_HEADER}, e.g.
<img src="{CUSTOM_HEADER}" border="0" alt="" />
<div style="background-image:url({CUSTOM_HEADER});background-repeat:no-repeat">
If "background"/"background-image" url path is set in style.css, you will have to delete or comment that property in CSS file and add an inline style to the element containing the logo, e.g.
<div id="header" style="background: #FFF url({CUSTOM_HEADER}) no-repeat bottom;">
DELETE
any other occurrence of {CUSTOM_HEADER} in the file, including elements containing it
SAVE AND CLOSE
COPY AND PASTE THE FOLLOWING CODE IN A NEW FILE AND SAVE IT AS
include/custom_header.php
<?php
// Custom header file for Coppermine Picture Gallery 1.4.x
// Allows to show a random logo from a logos folder
// created in your theme's directory
// (c) 2008 Gian Luigi Rocca (Ludo)
// support: http://forum.coppermine-gallery.net/index.php?topic=50365.0
// Change $deflogo to match your default logo's name
$deflogo = 'top.jpg';
// Set $use_session to true if you want the logo to change on every
// session instead on every page visited.
// If you don't have 'session.auto_start' set to 1 in your PHP
// settings, to enable sessions you will have to add a line
// 'session_start();' at the end of your include/config.inc.php
$use_session = false;
$imgdir = 'themes/'.$CONFIG['theme'].'/images/';
$logodir = $imgdir."logos/";
$logo = $imgdir.$deflogo;
if ($dir = @opendir($logodir)) {
while (false !== ($file = @readdir($dir))) {
if (is_file($logodir.$file)) {
$files[] = $file;
}
}
if (isset($files)) {
$i = rand(0, count($files)-1);
$logo = $logodir.$files[$i];
}
}
if (!$use_session) {
echo $logo;
} else {
if (!isset($_SESSION['logo'])) $_SESSION['logo'] = $logo;
echo $_SESSION['logo'];
}
?>
Notes:
1) Change $deflogo to match your default logo's name
2) By default, logo changes on every page visited. If you'd like it to change on every session (so that every visitor gets the same logo until he closes browser), set $use_session to true. If you don't have 'session.auto_start' set to 1 in your PHP configuration file (check it from Admin Tools > phpinfo), to enable sessions you'll have to add a line
session_start();
at the end of your include/config.inc.php (just before ?>)
CREATE
a subfolder named 'logos' in themes/your theme/images and fulfill it with your logos
ENTER
'include/custom_header.php' in 'Path to custom header include' field under Configuration > Theme settings
SAVE AND ENJOY!