Manual:ImportImages.php

importImages.php is a script which uploads images to mediawiki from a local directory.

Example
php maintenance/importImages.php /path/to/images/directory png jpg gif bmp PNG JPG GIF BMP Directory recursion is not supported.

Arguments
A list of available commands can be found inside ImportImages.php beginning on line 290. Imports images and other media files into the wiki

USAGE: php importImages.php [options]



Options: --extensions=    Comma-separated list of allowable extensions, defaults to $wgFileExtensions --overwrite            Overwrite existing images with the same name (default is to skip them) --limit=          Limit the number of images to process. Ignored or skipped images are not counted. --from=          Ignore all files until the one with the given name. Useful for resuming aborted imports. should be the file's canonical database form. --skip-dupes           Skip images that were already uploaded under a different name (check SHA1) --sleep=          Sleep between files. Useful mostly for debugging. --user=      Set username of uploader, default 'Maintenance script' --check-userblock      Check if the user got blocked during import. --comment=       Set upload summary comment, default 'Importing image file'. --comment-file=  Set upload summary comment to the content of. --comment-ext=    Causes the comment for each file to be loaded from a file with the same name but the extension. If a global comment is also given, it is appended. --license=       Use an optional license template --dry                  Dry run, don't import anything --protect=    Specify the protect value (autoconfirmed,sysop) --unprotect            Unprotects all uploaded images

Other Examples
Example where the script doesn't find any picture to upload: vi-notebook:/var/lib/mediawiki1.7# php maintenance/importImages.php /store/wiki/absurd_pic jpg Import Images

Warning: Invalid argument supplied for foreach in /usr/share/mediawiki1.7/maintenance/importImages.php on line 34

Example of incorrect usage of import: vi-notebook:/var/lib/mediawiki1.7# php maintenance/importImages.php /store/wiki/absurd_pic/0/00 jpg Import Images

Saving Coke.jpg...failed. Saving JapanOrange.jpg...failed. Saving Friki.JPG...failed. It has failed because of files already existed at their destinations.

If only some files fail and they don't exist, chmod the images/temp, images/thumb and images/achive to 777 AND uncomment the $wgHashedUploadDirectory = false; in LocalSettings.php.