blob: f3a14e5bd1a751bad7e08f89b033022f04cbbfef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
/**
* Bootstrapping for test image file generation
*
* @file
*/
// Evaluate the include path relative to this file
$IP = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
// Start up MediaWiki in command-line mode
require_once( "$IP/maintenance/Maintenance.php" );
require("RandomImageGenerator.php");
class GenerateRandomImages extends Maintenance {
public function execute() {
$getOptSpec = array(
'dictionaryFile::',
'minWidth::',
'maxWidth::',
'minHeight::',
'maxHeight::',
'shapesToDraw::',
'shape::',
'number::',
'format::'
);
$options = getopt( null, $getOptSpec );
$format = isset( $options['format'] ) ? $options['format'] : 'jpg';
unset( $options['format'] );
$number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
unset( $options['number'] );
$randomImageGenerator = new RandomImageGenerator( $options );
$randomImageGenerator->writeImages( $number, $format );
}
}
$maintClass = 'GenerateRandomImages';
require( RUN_MAINTENANCE_IF_MAIN );
|