MediaWiki  REL1_19
generateRandomImages.php
Go to the documentation of this file.
00001 <?php
00008 // Evaluate the include path relative to this file
00009 $IP = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
00010 
00011 // Start up MediaWiki in command-line mode
00012 require_once( "$IP/maintenance/Maintenance.php" );
00013 require("RandomImageGenerator.php");
00014 
00015 class GenerateRandomImages extends Maintenance {
00016 
00017         public function execute() {
00018 
00019                 $getOptSpec = array(
00020                         'dictionaryFile::',
00021                         'minWidth::',
00022                         'maxWidth::',
00023                         'minHeight::',
00024                         'maxHeight::',
00025                         'shapesToDraw::',
00026                         'shape::',
00027 
00028                         'number::',
00029                         'format::'
00030                 );
00031                 $options = getopt( null, $getOptSpec );
00032 
00033                 $format = isset( $options['format'] ) ? $options['format'] : 'jpg';
00034                 unset( $options['format'] );
00035 
00036                 $number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
00037                 unset( $options['number'] );
00038 
00039                 $randomImageGenerator = new RandomImageGenerator( $options );
00040                 $randomImageGenerator->writeImages( $number, $format );
00041         }
00042 }
00043 
00044 $maintClass = 'GenerateRandomImages';
00045 require( RUN_MAINTENANCE_IF_MAIN );
00046 
00047