make media directory configurable and check media file for existence
This commit is contained in:
parent
74abd9a7ff
commit
3f686005e3
2 changed files with 13 additions and 3 deletions
|
|
@ -59,7 +59,8 @@
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $dirs = array(
|
public static $dirs = array(
|
||||||
'locale' => 'locale'
|
'locale' => 'locale',
|
||||||
|
'media' => 'media'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,13 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Action: index.
|
* Action: index.
|
||||||
|
*
|
||||||
|
* Display a medium without processing.
|
||||||
|
*
|
||||||
|
* @throws IdNotFoundException
|
||||||
|
* @param string $seminaryUrl URL-title of the Seminary
|
||||||
|
* @param string $mediaUrl URL-name of the medium
|
||||||
*/
|
*/
|
||||||
public function index($seminaryUrl, $mediaUrl)
|
public function index($seminaryUrl, $mediaUrl)
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +66,10 @@
|
||||||
$this->response->addHeader("Content-type: ".$media['mimetype']."");
|
$this->response->addHeader("Content-type: ".$media['mimetype']."");
|
||||||
|
|
||||||
// Set filename
|
// Set filename
|
||||||
$media['filename'] = ROOT.DS.'media'.DS.$media['id'];
|
$media['filename'] = ROOT.DS.\nre\configs\AppConfig::$dirs['media'].DS.$media['id'];
|
||||||
|
if(!file_exists($media['filename'])) {
|
||||||
|
throw new \nre\exceptions\IdNotFoundException($mediaUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Pass data to view
|
// Pass data to view
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue