How do I export and import images from and into a MediaWiki?
相关问题
- Views base64 encoded blob in HTML with PHP
- How to get the background from multiple images by
- CV2 Image Error: error: (-215:Assertion failed) !s
- How to reimport module with ES6 import
- Replace image attributes for lazyload plugin on im
相关文章
- Use savefig in Python with string and iterative in
- Where does this quality loss on Images come from?
- Specifying image dimensions in HTML vs CSS for pag
- How to insert pictures into each individual bar in
- How do I append metadata to an image in Matlab?
- Img url to dataurl using JavaScript
- Click an image, get coordinates
- C# Saving huge images
Terminal solutions
MediaWiki administrator, at server's terminal, can perform maintenance tasks using the Maintenance scripts framework. New Mediawiki versions run all standard scripts in the tasks described below, but old versions have some bugs or not have all moderns scripts: check the version number by
grep wgVersion includes/DefaultSettings.php
.Note: all cited (below) scripts have also
--help
option, for instancephp maintenance/importImages.php --help
Original image folder
Users upload files through the Special:Upload page; administrators can configure the allowed file types through an extension whitelist. Once uploaded, files are stored in a folder on the file system, and thumbnails in a dedicated thumb directory.
The Mediawiki's
images
folder can be zipped withzip -r ~/Mediafiles.zip images
command, but this zip is not so good:there are a lot of expurious files: "deleted files" and "old files" (not the current) with filenames as
20160627184943!MyFig.png
, and thumbnails asMyFig.png/120px-MyFig.jpg
.for data-interchange or long-term preservation porpurses, it is invalid... The ugly
images/?/??/*
folder format is not suitable, as usual "all image files in only one folder".Images export/import
For "Exporting and Importing" all current images in one folder at MediaWiki server's terminal, there are a step-by-step single procedure.
Step-1: generate the image dumps using dumpUploads (with
--local
or--shared
options when preservation need), that creates a txt list of all image filenames in use.The command results in a standard zip file of your image backup folder,
Mediafiles.zip
at yor user root directory (~/
).NOTE: if you are not worried about the ugly folder strutcture, a more direct way is
according Mediawiki version the
--base=./
option will work fine and you can remove thesed
command of the pipe.Step-2: need a backup? installing a copy of the images? ... you need only
Mediafiles.zip
, and the Mediawiki installed, with no contents... If the Wiki have contents, check problems with filename conflicks (!). Another problem is configuration of file formats and permissions, that must be the same or broader in the new Wiki, see Manual:Configuring file uploads.Step-3: restore the dumps (to the new Wiki), with the maintenance tools. Supposing that you used step-1 to export and preserve in a zip file,
That is all. Check, navegating in your new Wiki's Special:NewFiles.
The full export or preservation
For exporting "ALL images and ALL articles" of your old MediaWiki, for full backup or content preservation. Add some procedures at each step:
Step-1: ... see above step-1... and, to generate the text-content dumps from the old Wiki
php dumpBackup.php --full | gzip | ~/dumpContent.xml.gz
Note: instead of
--full
you can use the--current
option.Step-2: ... you need
dumpContent.xml.zip
andMediafiles.zip
... from the old Wiki. Suppose both zip files at your~
folder.Step-3: run in your new Wiki
That is all. Check also Special:AllPages of the new Wiki.
There are a few mass upload tools available.
Commonist - www.djini.de/software/commonist/
Both run on the desktop and can be configured to upload to your local wiki (they are configured for Wikipedia and Wikimedia commons by default). If you are afraid to edit the content of a .jar file, I suggest you start with Commonplace.
Another useful extension exists for Mediawiki itself.
MultiUpload - http://www.mediawiki.org/wiki/Extension:MultiUpload
This extension allows you to drop images in a folder and load them all at once. It supports annotations for each file if necessary and cleans up the folder once it is done. On the downside, it requires opening a shared folder on the server side.
Commonplace - commons.wikimedia.org/wiki/Commons:Tools/Commonplace
used to be available, but it was deprecated as of Jan. 13, 2010.
There is no automatic way to export images like you export pages, you have to right click on them, and choose "save image". To get the history of the Image page, use the Special:Export page.
To import images use the Special:Upload page on your wiki. If you have lots of them, you can use the Import Images script. Note: you generally have to be in the sysop group to upload images.
- Export ALL:
You can get all pages and all images from a MediaWiki web using [API], even you are not the owner of the web (of course when the owner hasn't disable this function):
Step 1: Using API to get all pages title and all images url. You can write some code to do it automatically.
Step 2: Next you use [Special:Export] to export all pages with the titles you got, and use
wget
to get all images you had links (like thiswget -i img-list.txt
).- Import ALL:
Step 1: Import pages using [Special:Import]
Step 2: Import images using [Manual:ImportImages.php].
Hope this helps a bit: http://www.mediawiki.org/wiki/Manual:ImportImages.php