Manual:ImportImages.php/fr

importImages.php est un script qui permet de téléverser des images dans MediaWiki à partir de l'ordinateur sur lequel le wiki est configuré. Il réalise un téléversement à distance lorsque le paramètre de configuration est configuré correctement, ou si vous utilisez une extension telle que l'extension  qui le configure correctement.

Exemples
Upload with default comment "Importing file" and default user "Maintenance script": php maintenance/importImages.php /path/to/images/directory

Upload with custom comment "Importing files from local file repository" and default user "Maintenance script": php maintenance/importImages.php /path/to/images/directory --comment="Importing files from local file repository"

Upload with custom comment "Importing files from local file repository" and custom user "Upload admin" (which must already exist, or an error will occur): php maintenance/importImages.php /path/to/images/directory --comment="Importing files from local file repository" --user="Upload admin"

"importImages.php" will not search and upload images in sub-directories (directory recursion) by default. Therefore upload with custom comment "Importing files from local file repository", custom user "Upload admin": and recursively search for files in subdirectories: php maintenance/importImages.php /path/to/images/directory --comment="Importing files from local file repository" --user="Upload admin" --search-recursively

"importImages.php" will not will not overwrite images if an image with the same name already exists on the wiki. Therefore upload with custom comment "Importing files from local file repository", custom user "Upload admin" and overwrite existing images: php maintenance/importImages.php /path/to/images/directory --comment="Importing files from local file repository" --user="Upload admin" --overwrite

The same as above but only overwriting the given image types, e.g. pdf (for .pdf-files): php maintenance/importImages.php /path/to/images/directory --comment="Importing files from local file repository" --user="Upload admin" --overwrite --extensions=pdf

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) --search-recursively   Search recursively for files in subdirectories. --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 file description, default 'Importing file'. --comment-file=  Set description to the content of. --comment-ext=    Causes the description for each file to be loaded from a                        file with the same name, but the extension. If a                       global description is also given, it is appended. --license=, the correct argument would be }}

Could not open lock file
Try  (even if it was already set to 755, sometimes it needs to be set to 777)

Does not find the picture to upload
Example where the script does not 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

Incorrect folder path

t@f66677:~/public_html/dead.com/public/w/maintenance$ php importImages.php /m gif bmp PNG JPG GIF BMP Import Images

No suitable files could be found for import.

Usually this is because the path to the folder is incorrect.

Upload failed error
The following error can be caused by two issues:
 * 1) Directory permissions needs to be changed, and/or
 * 2) user does not have the privileges to upload the pictures

Problem 1: Directory permissions needs to be changed
 * Solution: Change directory's mode


 * 1)  chmod four folders to 777:
 * 2) images,
 * 3) images/temp,
 * 4) images/thumb and
 * 5) images/archive
 * 6)  If it hasn't already been done, in LocalSettings.php, uncomment the line   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 upload privileges.

Voir aussi

 * - pour importer des pages
 * - pour exporter des pages