diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2019-10-16 18:06:37 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2019-10-16 18:06:37 +0200 |
commit | 8b6848dfb5d469076f05be226e862fab928cd53f (patch) | |
tree | 79ed0918ce01055bd89bd8225561636d69f64130 /app/class/media.php | |
parent | 580cbf28855e0d4b8c1a0e4802bdfb7bb42697de (diff) | |
download | wcms-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.php | 34 |
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 = ' . ')'; + 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 |