diff options
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Config.php | 1 | ||||
-rw-r--r-- | app/Model/File.php | 46 |
2 files changed, 45 insertions, 2 deletions
diff --git a/app/Model/Config.php b/app/Model/Config.php index cb044633..736ae08d 100644 --- a/app/Model/Config.php +++ b/app/Model/Config.php @@ -80,6 +80,7 @@ class Config extends Base 'fr_FR' => 'Français', 'it_IT' => 'Italiano', 'hu_HU' => 'Magyar', + 'nl_NL' => 'Nederlands', 'pl_PL' => 'Polski', 'pt_BR' => 'Português (Brasil)', 'ru_RU' => 'Русский', diff --git a/app/Model/File.php b/app/Model/File.php index f069c8cf..a8cce9f4 100644 --- a/app/Model/File.php +++ b/app/Model/File.php @@ -113,6 +113,38 @@ class File extends Base } /** + * Get all images for a given task + * + * @access public + * @param integer $task_id Task id + * @return array + */ + public function getAllImages($task_id) + { + return $this->db->table(self::TABLE) + ->eq('task_id', $task_id) + ->eq('is_image', 1) + ->asc('name') + ->findAll(); + } + + /** + * Get all files without images for a given task + * + * @access public + * @param integer $task_id Task id + * @return array + */ + public function getAllDocuments($task_id) + { + return $this->db->table(self::TABLE) + ->eq('task_id', $task_id) + ->eq('is_image', 0) + ->asc('name') + ->findAll(); + } + + /** * Check if a filename is an image * * @access public @@ -121,7 +153,17 @@ class File extends Base */ public function isImage($filename) { - return getimagesize($filename) !== false; + $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); + + switch ($extension) { + case 'jpeg': + case 'jpg': + case 'png': + case 'gif': + return true; + } + + return false; } /** @@ -188,7 +230,7 @@ class File extends Base $task_id, $original_filename, $destination_filename, - $this->isImage(FILES_DIR.$destination_filename) + $this->isImage($original_filename) ); } } |