aboutsummaryrefslogtreecommitdiff
path: root/app/class/media.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-10-16 18:06:37 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-10-16 18:06:37 +0200
commit8b6848dfb5d469076f05be226e862fab928cd53f (patch)
tree79ed0918ce01055bd89bd8225561636d69f64130 /app/class/media.php
parent580cbf28855e0d4b8c1a0e4802bdfb7bb42697de (diff)
downloadwcms-8b6848dfb5d469076f05be226e862fab928cd53f.tar.gz
wcms-8b6848dfb5d469076f05be226e862fab928cd53f.zip
generate better media codes and remove w-nav menu
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 = '&lt;audio controls src="' . $this->getincludepath() . '"&gt;&lt;/audio&gt;';
+ break;
+
+ case 'video':
+ $code = '&lt;video controls src="' . $this->getincludepath() . '"&gt;&lt;video/&gt;';
+ break;
+
+ }
+
+ return $code;
+
+ }
+
// _________________________________________________ G E T ____________________________________________________
@@ -199,5 +229,3 @@ class Media
}
-
-?> \ No newline at end of file