Manual:ImportImages.php

importImages.php is a script which imports images to mediawiki from a local directory. Example of invocation:

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

Arguments
A list is available in the source of ImportImages.php 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 if a conflicting-named image is found --user=      Set username of uploader, default 'Maintenance script' --comment=       Set upload summary comment, default 'Importing image file' --license=       Use an optional license template

Other Examples
Example where it 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.