Manual:ImportImages.php

importImages.php is a script which uploads images to mediawiki from the same computer where the wiki is configured. It doesn't do a remote upload.

Example
php maintenance/importImages.php /path/to/images/directory svg png jpg jpeg gif bmp SVG PNG JPG JPEG GIF BMP

Importimages.php will not search and upload images in sub-directories (directory recursion)

An example of what a successful import of one image (Foo.jpg) looks like:

Arguments
$ php importImages.php Import Images

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 the 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= by removing the # in front of the line.

Problem 2: user does not have the privileges to upload the pictures
 * Solution: switch users or change user privileges

Skipping existing pictures
By default, ImportImages.php will not overwrite pictures. If a picture with the same name already exists on the wiki, you will get this error:

php importImages.php /home gif bmp PNG JPG GIF BMP Import Images

Dadtest.jpg exists, skipping

Found: 1 Skipped: 1

To overwrite any images type:

php importImages.php /home gif bmp PNG JPG GIF BMP --overwrite

The result will be: Import Images

Dadtest.jpg exists, overwriting...done.

Found: 1 Overwritten: 1