Regenerate thumbnails if missing
This commit is contained in:
@@ -18,6 +18,7 @@ Improvements:
|
|||||||
* Add the possibility to append or not custom filters
|
* Add the possibility to append or not custom filters
|
||||||
* Make mail transports pluggable
|
* Make mail transports pluggable
|
||||||
* Do not show scroll-bars when a column is collapsed on Windows systems
|
* Do not show scroll-bars when a column is collapsed on Windows systems
|
||||||
|
* Regenerate thumbnails if missing
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class File extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the file content (work only for images)
|
* Display image
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
@@ -119,36 +119,38 @@ class File extends Base
|
|||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
||||||
|
|
||||||
if ($file['task_id'] != $task['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->contentType($this->file->getImageMimeType($file['name']));
|
||||||
|
$this->objectStorage->output($file['path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->contentType($this->file->getImageMimeType($file['name']));
|
|
||||||
$this->objectStorage->output($file['path']);
|
|
||||||
} catch (ObjectStorageException $e) {
|
} catch (ObjectStorageException $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return image thumbnails
|
* Display image thumbnails
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function thumbnail()
|
public function thumbnail()
|
||||||
{
|
{
|
||||||
|
$this->response->contentType('image/jpeg');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
||||||
|
|
||||||
if ($file['task_id'] != $task['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->objectStorage->output($this->file->getThumbnailPath($file['path']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->contentType('image/jpeg');
|
|
||||||
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
|
|
||||||
} catch (ObjectStorageException $e) {
|
} catch (ObjectStorageException $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$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->file->generateThumbnailFromData($file['path'], $data);
|
||||||
|
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user