summaryrefslogtreecommitdiff
path: root/web/Result.php
diff options
context:
space:
mode:
authorCristei Gabriel <cristei.g772@gmail.com>2023-12-18 03:19:59 +0200
committerCristei Gabriel <cristei.g772@gmail.com>2023-12-18 03:19:59 +0200
commit6442494822d12c23cdd609031c4039d3309b64f6 (patch)
treec542f1039ecc8c5fe30cca3c3bad0481a0196d07 /web/Result.php
parent758de879cb759576604e325e0de1900da4fd8cf9 (diff)
dynamic ascii art
Diffstat (limited to 'web/Result.php')
-rw-r--r--web/Result.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/web/Result.php b/web/Result.php
new file mode 100644
index 0000000..52e4c83
--- /dev/null
+++ b/web/Result.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * The basic Result class for the Img2Ascii processor.
+ *
+ * It defines common output functions for the implementing output
+ * transformers.
+ *
+ * (c) 2016 Alex Schenkel
+ */
+namespace Img2Ascii;
+
+class Result {
+ public $ascii;
+ public function __construct(&$ascii) {
+ $this->ascii =& $ascii;
+ }
+
+ public function writeFile($path, $lineEnding = "\n") {
+ $fh = fopen($path,'w');
+ foreach($this->ascii as $line) {
+ foreach($line as $value) {
+ $value = $this->transformValue($value);
+ fputs($fh, $value);
+ }
+ fputs($fh,$lineEnding);
+
+ }
+ fclose($fh);
+ return $this;
+ }
+}