Fixes operation in subfolders

This commit is contained in:
Samuel Georges 2015-04-16 19:13:33 +10:00
parent 7fb36588cc
commit 0b82e1f44f
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
<?php namespace Cms\Classes;
use Request;
use ApplicationException;
use SystemException;
use Config;
@ -58,9 +59,12 @@ class MediaLibrary
*/
protected function init()
{
$this->storageFolder = self::validatePath(Config::get('cms.storage.media.folder', 'media'), true);
$this->storagePath = rtrim(Config::get('cms.storage.media.path', '/storage/app/media'), '/');
$this->storageFolder = self::validatePath(
Config::get('cms.storage.media.folder', 'media'), true);
if (!preg_match("/(\/\/|http|https)/", $this->storagePath)) {
$this->storagePath = Request::getBasePath() . $this->storagePath;
}
$this->ignoreNames = Config::get('cms.storage.media.ignore', $this->defaultIgnoreNames);
$this->storageFolderNameLength = strlen($this->storageFolder);