| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * generate some thousand images |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | $config = array( |
|---|
| 7 | 'text' => 'test', |
|---|
| 8 | 'file' => 'test.png', |
|---|
| 9 | 'inde' => 0, |
|---|
| 10 | 'size' => array('w'=>'80', 'h'=>'32'), |
|---|
| 11 | ); |
|---|
| 12 | |
|---|
| 13 | for($i = 0; $i < 80000; $i ++) { |
|---|
| 14 | $config['text'] = (int) $i; |
|---|
| 15 | $config['file'] = sprintf('%05d.png', $i); |
|---|
| 16 | create_image($config); |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | function create_image($config) { |
|---|
| 20 | extract($config); |
|---|
| 21 | |
|---|
| 22 | $im = imagecreate($size['w'], $size['h']); |
|---|
| 23 | $white = ImageColorAllocate ($im, 255, 255, 255); |
|---|
| 24 | $black = ImageColorAllocate ($im, 0, 0, 0); |
|---|
| 25 | $grey = ImageColorAllocate ($im, 102, 102, 102); |
|---|
| 26 | $mask = ImageColorAllocate ($im, 255, 0, 255); |
|---|
| 27 | |
|---|
| 28 | imagettftext($im, 8, 0, 0, 14, $mask, 'verdana.ttf', $text); |
|---|
| 29 | imagepng($im, $file); |
|---|
| 30 | imagedestroy($im); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | return; #EOF |
|---|
| 35 | ?> |
|---|