MediaWiki LocalSettings.php

出自ChevyneWiki
於 2021年1月14日 (四) 17:52 由 Chevyne留言 | 貢獻 所做的修訂
跳至導覽 跳至搜尋

Logo & Icon

  • 設定 Logo 及 Icon
    icon => 最大 50 x 50 pixels
    1x => 最大 135 x 135 pixels
    1.5x => 最大 202 x 202 pixels
    2x => 最大 270 x 270 pixels
    svg => 需是方形
## The URL paths to the logo.  Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
## $wgLogos = [ '1x' => "$wgResourceBasePath/resources/assets/wiki.png" ];
$wgLogos = [
	'1x' => "path/to/1x_version.png",
	'1.5x' => "path/to/1.5x_version.png",
	'2x' => "path/to/2x_version.png",
	'svg' => "path/to/svg_version.svg",
	'icon' => "path/to/icon.png",  // A version of the logo without wordmark and tagline
	'wordmark' => [
		'src' => "path/to/wordmark_version.png",
		'1x' => "path/to/wordmark_version.svg", // optional if you want to support browsers with SVG support with an SVG logo.
		'width' => 135,
		'height' => 20,
	],
	'tagline' => [
		'src' => "path/to/tagline_version.png",
		'width' => 135,
		'height' => 15,
	],
];

$wgFavicon = "path/to/Favicon.ico";
$wgAppleTouchIcon = "path/to/AppleTouchIcon.ico";
  • 隨機 Logo
$logoNames[] = "Logo01.png";
$logoNames[] = "Logo02.png";
$logoNames[] = "Logo03.png";
$logoNames[] = "Logo04.png";
$logoNames[] = "Logo05.png";
$wgLogo = "/myWiki/skins/common/images/".$logoNames[array_rand($logoNames)];
  • 移除 Logo
$wgLogo = "";

上傳

## 開啟上傳功能,預設上傳路徑在images資料夾
$wgEnableUploads = true;
## 允許上傳的檔案類型,此選項請手動加入LocalSettings.php中,預設無此選項。
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg','zip','doc','ppt','pdf','xls');
## 建議設為false,可給予使用多較的彈性。
$wgStrictFileExtensions = false;
## 上傳大小,以byte為單位,預設為150K,建議改為10 M。
$wgUploadSizeWarning = 10 * 1024 * 1024;

開啟外部圖片功能

MeiaWiki預設只能顯示上傳到本身網站的圖片連結,例如檔案:Example.jpg;但對於外部圖片是無法顯示的,此功能的選項如下,將其設為true即可開啟:

$wgAllowExternalImages = false;

然後就可以使用URL的方式來顯示圖片。