mirror of
https://github.com/php/phpruntests.git
synced 2026-03-25 08:32:21 +01:00
39 lines
629 B
PHP
39 lines
629 B
PHP
<?php
|
|
|
|
class taskConvert extends task implements taskInterface
|
|
{
|
|
private $sourceFile = NULL;
|
|
|
|
|
|
public function __construct($sourceFile)
|
|
{
|
|
$this->sourceFile = $sourceFile;
|
|
}
|
|
|
|
|
|
public function run()
|
|
{
|
|
if (is_null($this->sourceFile)) {
|
|
|
|
$this->setState(self::FAIL);
|
|
$this->setMessage('no source file');
|
|
return false;
|
|
}
|
|
|
|
$reader = new fileReader('example3/files/src'.$this->sourceFile);
|
|
$reader->read();
|
|
$chars = $reader->getAsciiChars();
|
|
|
|
$n = 'example3/files/dest'.$this->sourceFile.'.png';
|
|
|
|
$img = new imageCreator($chars);
|
|
$img->draw();
|
|
$img->saveImage($n);
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|