summaryrefslogtreecommitdiff
path: root/app/Helper/File.php
diff options
context:
space:
mode:
authorGerardo Zamudio <gerardozamudio@users.noreply.github.com>2016-02-24 23:48:50 -0600
committerGerardo Zamudio <gerardozamudio@users.noreply.github.com>2016-02-24 23:48:50 -0600
commite4de6b3898b64b26d29aff31f21df5fda8055686 (patch)
tree575f8a65440f291d70a070d168eafca8c82a6459 /app/Helper/File.php
parentd9ffbea174ea6524d0a22f8375ca8b3aa04a3c96 (diff)
parenta6540bc604c837d92c9368540c145606723e97f7 (diff)
Merge pull request #1 from fguillot/master
Update from upstream
Diffstat (limited to 'app/Helper/File.php')
-rw-r--r--app/Helper/File.php57
1 files changed, 54 insertions, 3 deletions
diff --git a/app/Helper/File.php b/app/Helper/File.php
index d2cdfc6a..b493e64f 100644
--- a/app/Helper/File.php
+++ b/app/Helper/File.php
@@ -38,19 +38,70 @@ class File extends \Kanboard\Core\Base
return 'fa-file-powerpoint-o';
case 'zip':
case 'rar':
+ case 'tar':
+ case 'bz2':
+ case 'xz':
+ case 'gz':
return 'fa-file-archive-o';
case 'mp3':
- return 'fa-audio-o';
+ return 'fa-file-audio-o';
case 'avi':
- return 'fa-video-o';
+ case 'mov':
+ return 'fa-file-video-o';
case 'php':
case 'html':
case 'css':
- return 'fa-code-o';
+ return 'fa-file-code-o';
case 'pdf':
return 'fa-file-pdf-o';
}
return 'fa-file-o';
}
+
+ /**
+ * Return the image mimetype based on the file extension
+ *
+ * @access public
+ * @param $filename
+ * @return string
+ */
+ public function getImageMimeType($filename)
+ {
+ $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
+
+ switch ($extension) {
+ case 'jpeg':
+ case 'jpg':
+ return 'image/jpeg';
+ case 'png':
+ return 'image/png';
+ case 'gif':
+ return 'image/gif';
+ default:
+ return 'image/jpeg';
+ }
+ }
+
+ /**
+ * Get the preview type
+ *
+ * @access public
+ * @param string $filename
+ * @return string
+ */
+ public function getPreviewType($filename)
+ {
+ $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
+
+ switch ($extension) {
+ case 'md':
+ case 'markdown':
+ return 'markdown';
+ case 'txt':
+ return 'text';
+ }
+
+ return null;
+ }
}