[TASK] Added a very simple progress indicator.
This commit is contained in:
parent
9eebcddb84
commit
9342827940
|
@ -90,6 +90,7 @@ class FileImageConverter {
|
||||||
$this->image->setCurrentPixel($r, $g, $b, 0);
|
$this->image->setCurrentPixel($r, $g, $b, 0);
|
||||||
//move the pointer
|
//move the pointer
|
||||||
$this->image->movePointer(1);
|
$this->image->movePointer(1);
|
||||||
|
$this->progressBar($i, $strlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -97,7 +98,19 @@ class FileImageConverter {
|
||||||
echo "Caught Exception:\n";
|
echo "Caught Exception:\n";
|
||||||
echo $e;
|
echo $e;
|
||||||
}
|
}
|
||||||
|
echo "\rDone.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a simple progressbar using \r
|
||||||
|
* @param int $x
|
||||||
|
* @param int $total
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function progressBar($x, $total) {
|
||||||
|
$percent = round($x / $total * 100, 2);
|
||||||
|
echo " \r";
|
||||||
|
echo "Working... " . $percent . " %";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 367 KiB |
Loading…
Reference in New Issue