Add file attachements to projects

This commit is contained in:
Frederic Guillot 2016-02-16 21:12:43 -05:00
parent 5bbc903dca
commit 8936792f6f
20 changed files with 449 additions and 194 deletions

View File

@ -201,6 +201,36 @@ abstract class Base extends \Kanboard\Core\Base
return $task;
}
/**
* Get Task or Project file
*
* @access protected
*/
protected function getFile()
{
$task_id = $this->request->getIntegerParam('task_id');
$file_id = $this->request->getIntegerParam('file_id');
$model = 'projectFile';
if ($task_id > 0) {
$model = 'taskFile';
$project_id = $this->taskFinder->getProjectId($task_id);
if ($project_id !== $this->request->getIntegerParam('project_id')) {
$this->forbidden();
}
}
$file = $this->$model->getById($file_id);
if (empty($file)) {
$this->notfound();
}
$file['model'] = $model;
return $file;
}
/**
* Common method to get a project
*

View File

@ -0,0 +1,89 @@
<?php
namespace Kanboard\Controller;
use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
* File Viewer Controller
*
* @package controller
* @author Frederic Guillot
*/
class FileViewer extends Base
{
/**
* Show file content in a popover
*
* @access public
*/
public function show()
{
$file = $this->getFile();
$params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id'));
if ($file['model'] === 'taskFile') {
$params['task_id'] = $file['task_id'];
}
$this->response->html($this->template->render('file_viewer/show', array(
'file' => $file,
'params' => $params,
)));
}
/**
* Display image
*
* @access public
*/
public function image()
{
try {
$file = $this->getFile();
$this->response->contentType($this->helper->file->getImageMimeType($file['name']));
$this->objectStorage->output($file['path']);
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
}
/**
* Display image thumbnail
*
* @access public
*/
public function thumbnail()
{
$this->response->contentType('image/jpeg');
try {
$file = $this->getFile();
$model = $file['model'];
$this->objectStorage->output($this->$model->getThumbnailPath($file['path']));
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
// Try to generate thumbnail on the fly for images uploaded before Kanboard < 1.0.19
$data = $this->objectStorage->get($file['path']);
$this->$model->generateThumbnailFromData($file['path'], $data);
$this->objectStorage->output($this->$model->getThumbnailPath($file['path']));
}
}
/**
* File download
*
* @access public
*/
public function download()
{
try {
$file = $this->getFile();
$this->response->forceDownload($file['name']);
$this->objectStorage->output($file['path']);
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace Kanboard\Controller;
/**
* Project File Controller
*
* @package controller
* @author Frederic Guillot
*/
class ProjectFile extends Base
{
/**
* File upload form
*
* @access public
*/
public function create()
{
$project = $this->getProject();
$this->response->html($this->template->render('project_file/create', array(
'project' => $project,
'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
)));
}
/**
* Save uploaded files
*
* @access public
*/
public function save()
{
$project = $this->getProject();
if (! $this->projectFile->uploadFiles($project['id'], $this->request->getFileInfo('files'))) {
$this->flash->failure(t('Unable to upload the file.'));
}
$this->response->redirect($this->helper->url->to('ProjectOverview', 'show', array('project_id' => $project['id'])), true);
}
/**
* Remove a file
*
* @access public
*/
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$file = $this->projectFile->getById($this->request->getIntegerParam('file_id'));
if ($this->projectFile->remove($file['id'])) {
$this->flash->success(t('File removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this file.'));
}
$this->response->redirect($this->helper->url->to('ProjectOverview', 'show', array('project_id' => $project['id'])));
}
/**
* Confirmation dialog before removing a file
*
* @access public
*/
public function confirm()
{
$project = $this->getProject();
$file = $this->projectFile->getById($this->request->getIntegerParam('file_id'));
$this->response->html($this->template->render('project_file/remove', array(
'project' => $project,
'file' => $file,
)));
}
}

View File

@ -19,6 +19,8 @@ class ProjectOverview extends Base
$params['users'] = $this->projectUserRole->getAllUsersGroupedByRole($params['project']['id']);
$params['roles'] = $this->role->getProjectRoles();
$params['events'] = $this->projectActivity->getProject($params['project']['id'], 10);
$params['images'] = $this->projectFile->getAllImages($params['project']['id']);
$params['files'] = $this->projectFile->getAllDocuments($params['project']['id']);
$this->project->getColumnStats($params['project']);

View File

@ -2,10 +2,8 @@
namespace Kanboard\Controller;
use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
* File File Controller
* Task File Controller
*
* @package controller
* @author Frederic Guillot
@ -26,7 +24,7 @@ class TaskFile extends Base
return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
}
$this->response->html($this->helper->layout->task('task_file/screenshot', array(
$this->response->html($this->template->render('task_file/screenshot', array(
'task' => $task,
)));
}
@ -40,7 +38,7 @@ class TaskFile extends Base
{
$task = $this->getTask();
$this->response->html($this->helper->layout->task('task_file/new', array(
$this->response->html($this->template->render('task_file/create', array(
'task' => $task,
'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
)));
@ -62,92 +60,6 @@ class TaskFile extends Base
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
}
/**
* File download
*
* @access public
*/
public function download()
{
try {
$task = $this->getTask();
$file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
}
$this->response->forceDownload($file['name']);
$this->objectStorage->output($file['path']);
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
}
/**
* Open a file (show the content in a popover)
*
* @access public
*/
public function open()
{
$task = $this->getTask();
$file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] == $task['id']) {
$this->response->html($this->template->render('task_file/open', array(
'file' => $file,
'task' => $task,
)));
}
}
/**
* Display image
*
* @access public
*/
public function image()
{
try {
$task = $this->getTask();
$file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] == $task['id']) {
$this->response->contentType($this->taskFile->getImageMimeType($file['name']));
$this->objectStorage->output($file['path']);
}
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
}
/**
* Display image thumbnails
*
* @access public
*/
public function thumbnail()
{
$this->response->contentType('image/jpeg');
try {
$task = $this->getTask();
$file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] == $task['id']) {
$this->objectStorage->output($this->taskFile->getThumbnailPath($file['path']));
}
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
// Try to generate thumbnail on the fly for images uploaded before Kanboard < 1.0.19
$data = $this->objectStorage->get($file['path']);
$this->taskFile->generateThumbnailFromData($file['path'], $data);
$this->objectStorage->output($this->taskFile->getThumbnailPath($file['path']));
}
}
/**
* Remove a file
*
@ -178,7 +90,7 @@ class TaskFile extends Base
$task = $this->getTask();
$file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
$this->response->html($this->helper->layout->task('task_file/remove', array(
$this->response->html($this->template->render('task_file/remove', array(
'task' => $task,
'file' => $file,
)));

View File

@ -58,4 +58,28 @@ class File extends \Kanboard\Core\Base
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';
}
}
}

View File

@ -188,30 +188,6 @@ abstract class File extends Base
return false;
}
/**
* 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';
}
}
/**
* Generate the path for a thumbnails
*

View File

@ -0,0 +1,8 @@
<div class="page-header">
<h2><?= $this->e($file['name']) ?></h2>
<div class="task-file-viewer">
<?php if ($file['is_image']): ?>
<img src="<?= $this->url->href('FileViewer', 'image', $params) ?>" alt="<?= $this->e($file['name']) ?>">
<?php endif ?>
</div>
</div>

View File

@ -0,0 +1,33 @@
<div class="page-header">
<h2><?= t('Attach a document') ?></h2>
</div>
<div id="file-done" style="display:none">
<p class="alert alert-success">
<?= t('All files have been uploaded successfully.') ?>
<?= $this->url->link(t('View uploaded files'), 'ProjectOverview', 'show', array('project_id' => $project['id'])) ?>
</p>
</div>
<div id="file-error-max-size" style="display:none">
<p class="alert alert-error">
<?= t('The maximum allowed file size is %sB.', $this->text->bytes($max_size)) ?>
<a href="#" id="file-browser"><?= t('Choose files again') ?></a>
</p>
</div>
<div
id="file-dropzone"
data-max-size="<?= $max_size ?>"
data-url="<?= $this->url->href('ProjectFile', 'save', array('project_id' => $project['id'])) ?>">
<div id="file-dropzone-inner">
<?= t('Drag and drop your files here') ?> <?= t('or') ?> <a href="#" id="file-browser"><?= t('choose files') ?></a>
</div>
</div>
<input type="file" name="files[]" multiple style="display:none" id="file-form-element">
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue" id="file-upload-button" disabled>
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'ProjectOverview', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
</div>

View File

@ -0,0 +1,15 @@
<div class="page-header">
<h2><?= t('Remove a file') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info">
<?= t('Do you really want to remove this file: "%s"?', $this->e($file['name'])) ?>
</p>
<div class="form-actions">
<?= $this->url->link(t('Yes'), 'ProjectFile', 'remove', array('project_id' => $project['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?>
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'ProjectOverview', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
</div>
</div>

View File

@ -0,0 +1,8 @@
<div class="project-overview-columns">
<?php foreach ($project['columns'] as $column): ?>
<div class="project-overview-column">
<strong title="<?= t('Task count') ?>"><?= $column['nb_tasks'] ?></strong><br>
<span><?= $this->e($column['title']) ?></span>
</div>
<?php endforeach ?>
</div>

View File

@ -0,0 +1,8 @@
<?php if (! empty($project['description'])): ?>
<div class="page-header">
<h2><?= $this->e($project['name']) ?></h2>
</div>
<article class="markdown">
<?= $this->text->markdown($project['description']) ?>
</article>
<?php endif ?>

View File

@ -0,0 +1,92 @@
<div class="page-header">
<h2><?= t('Attachments') ?></h2>
<?php if ($this->user->hasProjectAccess('ProjectFile', 'create', $project['id'])): ?>
<ul>
<li>
<i class="fa fa-plus fa-fw"></i>
<?= $this->url->link(t('Upload a file'), 'ProjectFile', 'create', array('project_id' => $project['id']), false, 'popover') ?>
</li>
</ul>
<?php endif ?>
</div>
<?php if (empty($files) && empty($images)): ?>
<p class="alert"><?= t('There is no attachment at the moment.') ?></p>
<?php endif ?>
<?php if (! empty($images)): ?>
<div class="file-thumbnails">
<?php foreach ($images as $file): ?>
<div class="file-thumbnail">
<a href="<?= $this->url->href('FileViewer', 'show', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $project['id'])) ?>" title="<?= $this->e($file['name']) ?>" alt="<?= $this->e($file['name']) ?>"></a>
<div class="file-thumbnail-content">
<div class="file-thumbnail-title">
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->e($file['name']) ?> <i class="fa fa-caret-down"></i></a>
<ul>
<?php if ($this->user->hasProjectAccess('ProjectFile', 'remove', $project['id'])): ?>
<li>
<i class="fa fa-trash fa-fw"></i>
<?= $this->url->link(t('Remove'), 'ProjectFile', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?>
</li>
<?php endif ?>
<li>
<i class="fa fa-download fa-fw"></i>
<?= $this->url->link(t('Download'), 'FileViewer', 'download', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?>
</li>
</ul>
</div>
</div>
<div class="file-thumbnail-description">
<span class="tooltip" title='<?= t('Uploaded: %s', $this->dt->datetime($file['date'])).'<br>'.t('Size: %s', $this->text->bytes($file['size'])) ?>'>
<i class="fa fa-info-circle"></i>
</span>
<?= t('Uploaded by %s', $file['user_name'] ?: $file['username']) ?>
</div>
</div>
</div>
<?php endforeach ?>
</div>
<?php endif ?>
<?php if (! empty($files)): ?>
<table class="table-stripped">
<tr>
<th><?= t('Filename') ?></th>
<th><?= t('Creator') ?></th>
<th><?= t('Date') ?></th>
<th><?= t('Size') ?></th>
</tr>
<?php foreach ($files as $file): ?>
<tr>
<td>
<i class="fa <?= $this->file->icon($file['name']) ?> fa-fw"></i>
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->e($file['name']) ?> <i class="fa fa-caret-down"></i></a>
<ul>
<?php if ($this->user->hasProjectAccess('ProjectFile', 'remove', $project['id'])): ?>
<li>
<i class="fa fa-trash fa-fw"></i>
<?= $this->url->link(t('Remove'), 'ProjectFile', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?>
</li>
<?php endif ?>
<li>
<i class="fa fa-download fa-fw"></i>
<?= $this->url->link(t('Download'), 'FileViewer', 'download', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?>
</li>
</ul>
</div>
</td>
<td>
<?= $this->e($file['user_name'] ?: $file['username']) ?>
</td>
<td>
<?= $this->dt->date($file['date']) ?>
</td>
<td>
<?= $this->text->bytes($file['size']) ?>
</td>
</tr>
<?php endforeach ?>
</table>
<?php endif ?>

View File

@ -0,0 +1,35 @@
<div class="page-header">
<h2><?= t('Information') ?></h2>
</div>
<div class="listing">
<ul>
<?php if ($project['owner_id'] > 0): ?>
<li><?= t('Project owner: ') ?><strong><?= $this->e($project['owner_name'] ?: $project['owner_username']) ?></strong></li>
<?php endif ?>
<?php if (! empty($users)): ?>
<?php foreach ($roles as $role => $role_name): ?>
<?php if (isset($users[$role])): ?>
<li>
<?= $role_name ?>:
<strong><?= implode(', ', $users[$role]) ?></strong>
</li>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
<?php if ($project['start_date']): ?>
<li><?= t('Start date: ').$this->dt->date($project['start_date']) ?></li>
<?php endif ?>
<?php if ($project['end_date']): ?>
<li><?= t('End date: ').$this->dt->date($project['end_date']) ?></li>
<?php endif ?>
<?php if ($project['is_public']): ?>
<li><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li>
<li><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'feed', 'project', array('token' => $project['token']), false, '', '', true) ?></li>
<li><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'project', array('token' => $project['token'])) ?></li>
<?php endif ?>
</ul>
</div>

View File

@ -4,60 +4,10 @@
'filters' => $filters,
)) ?>
<div class="project-overview-columns">
<?php foreach ($project['columns'] as $column): ?>
<div class="project-overview-column">
<strong title="<?= t('Task count') ?>"><?= $column['nb_tasks'] ?></strong><br>
<span><?= $this->e($column['title']) ?></span>
</div>
<?php endforeach ?>
</div>
<?php if (! empty($project['description'])): ?>
<div class="page-header">
<h2><?= $this->e($project['name']) ?></h2>
</div>
<article class="markdown">
<?= $this->text->markdown($project['description']) ?>
</article>
<?php endif ?>
<div class="page-header">
<h2><?= t('Information') ?></h2>
</div>
<div class="listing">
<ul>
<?php if ($project['owner_id'] > 0): ?>
<li><?= t('Project owner: ') ?><strong><?= $this->e($project['owner_name'] ?: $project['owner_username']) ?></strong></li>
<?php endif ?>
<?php if (! empty($users)): ?>
<?php foreach ($roles as $role => $role_name): ?>
<?php if (isset($users[$role])): ?>
<li>
<?= $role_name ?>:
<strong><?= implode(', ', $users[$role]) ?></strong>
</li>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
<?php if ($project['start_date']): ?>
<li><?= t('Start date: ').$this->dt->date($project['start_date']) ?></li>
<?php endif ?>
<?php if ($project['end_date']): ?>
<li><?= t('End date: ').$this->dt->date($project['end_date']) ?></li>
<?php endif ?>
<?php if ($project['is_public']): ?>
<li><i class="fa fa-share-alt"></i> <?= $this->url->link(t('Public link'), 'board', 'readonly', array('token' => $project['token']), false, '', '', true) ?></li>
<li><i class="fa fa-rss-square"></i> <?= $this->url->link(t('RSS feed'), 'feed', 'project', array('token' => $project['token']), false, '', '', true) ?></li>
<li><i class="fa fa-calendar"></i> <?= $this->url->link(t('iCal feed'), 'ical', 'project', array('token' => $project['token'])) ?></li>
<?php endif ?>
</ul>
</div>
<?= $this->render('project_overview/columns', array('project' => $project)) ?>
<?= $this->render('project_overview/description', array('project' => $project)) ?>
<?= $this->render('project_overview/files', array('project' => $project, 'images' => $images, 'files' => $files)) ?>
<?= $this->render('project_overview/information', array('project' => $project, 'users' => $users, 'roles' => $roles)) ?>
<div class="page-header">
<h2><?= t('Last activity') ?></h2>

View File

@ -1,6 +0,0 @@
<div class="page-header">
<h2><?= $this->e($file['name']) ?></h2>
<div class="task-file-viewer">
<img src="<?= $this->url->href('TaskFile', 'image', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/>
</div>
</div>

View File

@ -8,7 +8,7 @@
<div class="file-thumbnails">
<?php foreach ($images as $file): ?>
<div class="file-thumbnail">
<a href="<?= $this->url->href('TaskFile', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('TaskFile', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->e($file['name']) ?>" alt="<?= $this->e($file['name']) ?>"></a>
<a href="<?= $this->url->href('FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->e($file['name']) ?>" alt="<?= $this->e($file['name']) ?>"></a>
<div class="file-thumbnail-content">
<div class="file-thumbnail-title">
<div class="dropdown">
@ -22,7 +22,7 @@
<?php endif ?>
<li>
<i class="fa fa-download fa-fw"></i>
<?= $this->url->link(t('Download'), 'TaskFile', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
<?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
</li>
</ul>
</div>
@ -62,7 +62,7 @@
<?php endif ?>
<li>
<i class="fa fa-download fa-fw"></i>
<?= $this->url->link(t('Download'), 'TaskFile', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
<?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
</li>
</ul>
</div>

View File

@ -8,8 +8,20 @@ class FileHelperTest extends Base
{
public function testIcon()
{
$h = new File($this->container);
$this->assertEquals('fa-file-image-o', $h->icon('test.png'));
$this->assertEquals('fa-file-o', $h->icon('test'));
$helper = new File($this->container);
$this->assertEquals('fa-file-image-o', $helper->icon('test.png'));
$this->assertEquals('fa-file-o', $helper->icon('test'));
}
public function testGetMimeType()
{
$helper = new File($this->container);
$this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.JPG'));
$this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.jpeg'));
$this->assertEquals('image/png', $helper->getImageMimeType('My File.PNG'));
$this->assertEquals('image/gif', $helper->getImageMimeType('My File.gif'));
$this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.bmp'));
$this->assertEquals('image/jpeg', $helper->getImageMimeType('My File'));
}
}

View File

@ -124,18 +124,6 @@ class TaskFileTest extends Base
$this->assertFalse($fileModel->isImage('test.pdf'));
}
public function testGetMimeType()
{
$fileModel = new TaskFile($this->container);
$this->assertEquals('image/jpeg', $fileModel->getImageMimeType('My File.JPG'));
$this->assertEquals('image/jpeg', $fileModel->getImageMimeType('My File.jpeg'));
$this->assertEquals('image/png', $fileModel->getImageMimeType('My File.PNG'));
$this->assertEquals('image/gif', $fileModel->getImageMimeType('My File.gif'));
$this->assertEquals('image/jpeg', $fileModel->getImageMimeType('My File.bmp'));
$this->assertEquals('image/jpeg', $fileModel->getImageMimeType('My File'));
}
public function testGetThumbnailPath()
{
$fileModel = new TaskFile($this->container);