mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
[ticket/10250] Overwrite the site_logo width&height when the phpbb logo is used
The new logo is slightly wider than the old logo. If we changed the size in the imageset.cfg we would cause a conflict for everyone who replaced the logo with their own and modified the size. Instead we overwrite the width and height in the img() function in session.php only if its contents are that of the stock phpbb logo. PHPBB3-10250
This commit is contained in:
@@ -2272,9 +2272,36 @@ class user extends session
|
||||
// Use URL if told so
|
||||
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;
|
||||
|
||||
$img_data['src'] = $root_path . 'styles/' . rawurlencode($this->theme['imageset_path']) . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename'];
|
||||
$path = 'styles/' . rawurlencode($this->theme['imageset_path']) . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename'];
|
||||
|
||||
$img_data['src'] = $root_path . $path;
|
||||
$img_data['width'] = $this->img_array[$img]['image_width'];
|
||||
$img_data['height'] = $this->img_array[$img]['image_height'];
|
||||
|
||||
// We overwrite the width and height to the phpbb logo's width
|
||||
// and height here if the contents of the site_logo file are
|
||||
// really equal to the phpbb_logo
|
||||
// This allows us to change the dimensions of the phpbb_logo without
|
||||
// modifying the imageset.cfg and causing a conflict for everyone
|
||||
// who modified it for their custom logo on updating
|
||||
if ($img == 'site_logo' && file_exists($phpbb_root_path . $path))
|
||||
{
|
||||
global $cache;
|
||||
|
||||
if (($img_file_hash = $cache->get('imageset_site_logo_md5')) === false)
|
||||
{
|
||||
$img_file_hash = md5(file_get_contents($phpbb_root_path . $path));
|
||||
$cache->put('imageset_site_logo_md5', $img_file_hash);
|
||||
}
|
||||
|
||||
$phpbb_logo_hash = '0c461a32cd3621643105f0d02a772c10';
|
||||
|
||||
if ($phpbb_logo_hash == $img_file_hash)
|
||||
{
|
||||
$img_data['width'] = '149';
|
||||
$img_data['height'] = '52';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$alt = (!empty($this->lang[$alt])) ? $this->lang[$alt] : $alt;
|
||||
|
Reference in New Issue
Block a user