aboutsummaryrefslogtreecommitdiff
path: root/app/class/media.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/class/media.php')
-rw-r--r--app/class/media.php34
1 files changed, 31 insertions, 3 deletions
diff --git a/app/class/media.php b/app/class/media.php
index eccc58b..f48c3b9 100644
--- a/app/class/media.php
+++ b/app/class/media.php
@@ -12,7 +12,7 @@ class Media
private $length;
const IMAGE = array('jpg', 'jpeg', 'gif', 'png');
- const SOUND = array('mp3', 'flac');
+ const SOUND = array('mp3', 'flac', 'wav', 'ogg');
const VIDEO = array('mp4', 'mov', 'avi', 'mkv');
@@ -79,6 +79,36 @@ class Media
return $this->path . $this->id . '.' . $this->extension;
}
+ /**
+ * Generate html code depending on media type
+ *
+ * @return string html code
+ */
+ public function getcode() : string
+ {
+ switch ($this->type) {
+ case 'image':
+ $code = '![' . $this->id . '](' . $this->getincludepath() . ')';
+ break;
+
+ case 'other':
+ $code = '[' . $this->id . '](' . $this->getincludepath() . ')';
+ break;
+
+ case 'sound':
+ $code = '<audio controls src="' . $this->getincludepath() . '"></audio>';
+ break;
+
+ case 'video':
+ $code = '<video controls src="' . $this->getincludepath() . '"><video/>';
+ break;
+
+ }
+
+ return $code;
+
+ }
+
// _________________________________________________ G E T ____________________________________________________
@@ -199,5 +229,3 @@ class Media
}
-
-?> \ No newline at end of file