The LocalSettings generated after MediaWiki is installed. some local configuration information is automatically recorded in the PHP file. Most mediawiki parameter settings are changed. You need to manually modify this file. You need to record the manual modifications made to this file, these settings can be rebuilt during future upgrades. For security reasons, please pay attention to setting Loca
The LocalSettings generated after MediaWiki is installed. some local configuration information is automatically recorded in the PHP file. Most mediawiki parameter settings are changed. You need to manually modify this file. You need to record the manual modifications made to this file, these settings can be rebuilt during future upgrades. For security reasons, please pay attention to setting Loca
MediaWiki uploads imagesThe LocalSettings generated after MediaWiki is installed in the tutorial. some local configuration information is automatically recorded in the PHP file. Most mediawiki parameter settings are changed. You need to manually modify this file. You need to record the manual modifications made to this file, this allows you to recreate these settings during future upgrades. For security reasons, pay attention to setting LocalSettings. php access permission to prohibit others from viewing the content. Here we will introduce some basic settings:
- $ WgDisableUploads: The default value is true. It is not allowed to upload files through the browser interface. To upload an image, change the value to false and set the upload directory to allow network writing. (After 1.5.x, this option is changed to $ wgEnableUploads: First remove the previous #; opposite to the old version, true indicates that upload is allowed, and false indicates that file upload is prohibited through the browser interface .)
- $ WgUseImageResize: set this parameter to true if you want to change the image size during running (for example, the thumbnail function.
- $ WgUseImageMagick: If the ImageMagick software runs normally, set this variable to true. At the same time, make sure that the $ wgImageMagickConvertCommand variable points to the correct location where the server runs the convert command.
Enable Mediawiki's Image Upload Function
- Set the images folder to writable.
- In the configuration file LocalSettings. php, find
$wgEnableUploads = true;
Set to true.
In this way, the MediaWiki image upload function is enabled.
MediaWiki uploads and uses images
MediaWiki uploads images
The address of the Upload page is Special: Upload. You can also enter a Special page and then enter the Upload File page. Upload an image on this page, set the file name and description, and use it in the article after the upload is successful.
MediaWiki Images
Enter:
[[Image:file.jpg]]
The corresponding image is displayed.
MediaWiki limits the size of uploaded files
Add the following line in localsettings. php
$wgMaxUploadSize = 5020;
The Unit is byte. This does not work in new versions (versions 1.9.3 to 1.12). You need to restrict it in the php environment, in this case, the warning size for uploading large files is DefaultSetting. in php, the default value is 150 kb. If you are bored, you can increase the value (not recommended ).
MediaWiki references external Images
Add the following line in localsettings. php (security problems may occur ):
$wgAllowExternalImages = true;
Upload images through URLs (using publicly accessible image links for remote image uploads (this function is cool, :) but only operators can use it. Hey hey, security considerations, this is necessary ))
Add the following line in localsettings. php (which may cause security problems ):
$wgAllowCopyUploads = true;
Enable upload of other files
Enable upload of other files, such as doc, pdf, ppt, docx, and pptx.
Open the Des/DefaultSettings. php In the root directory of the wiki and modify $ wgFileExtensions. By default, this variable only supports 'png ', 'gif', 'jpg', and 'jpeg '. Change it
- $ WgFileExtensions = array ('png ', 'gif', 'jpg', 'jpeg ', 'doc', 'ppt ', 'pdf ');
The error message "This file contains or has an incorrect extension" is displayed during the upload process. Check this file and upload it again. "For example, you have set the allowed upload ppt type in wgFileExtensions. Why can't you upload the file? Open mongodes/DefaultSettings In the wiki root directory. php: Change $ wgVerifyMimeType to false. After a hundred times, pptx is processed as a zip file. word and ppt are normal.