mirror of
https://github.com/grocy/grocy.git
synced 2025-10-15 01:37:13 +00:00
Squashed commit
Always execute migration 9999 (can be used to fix things manually) Optimized meal plan navigation / date range filtering Prepared next release Pulled translations from Transifex Various code optimizations
This commit is contained in:
@@ -8,6 +8,30 @@ class FilesService extends BaseService
|
||||
{
|
||||
const FILE_SERVE_TYPE_PICTURE = 'picture';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->StoragePath = GROCY_DATAPATH . '/storage';
|
||||
if (!file_exists($this->StoragePath))
|
||||
{
|
||||
mkdir($this->StoragePath);
|
||||
}
|
||||
|
||||
if (GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
|
||||
{
|
||||
$dbSuffix = GROCY_DEFAULT_LOCALE;
|
||||
if (defined('GROCY_DEMO_DB_SUFFIX'))
|
||||
{
|
||||
$dbSuffix = GROCY_DEMO_DB_SUFFIX;
|
||||
}
|
||||
|
||||
$this->StoragePath = $this->StoragePath . '/' . $dbSuffix;
|
||||
if (!file_exists($this->StoragePath))
|
||||
{
|
||||
mkdir($this->StoragePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private $StoragePath;
|
||||
|
||||
public function DownscaleImage($group, $fileName, $bestFitHeight = null, $bestFitWidth = null)
|
||||
@@ -58,8 +82,9 @@ class FilesService extends BaseService
|
||||
$fileNameWithoutExtension = pathinfo($filePath, PATHINFO_FILENAME);
|
||||
$fileExtension = pathinfo($filePath, PATHINFO_EXTENSION);
|
||||
|
||||
// Then the file is an image
|
||||
if (getimagesize($filePath) !== false)
|
||||
{ // Then the file is an image
|
||||
{
|
||||
// Also delete all corresponding "__downscaledto" files when deleting an image
|
||||
$groupFolderPath = $this->StoragePath . '/' . $group;
|
||||
$files = scandir($groupFolderPath);
|
||||
@@ -87,32 +112,4 @@ class FilesService extends BaseService
|
||||
|
||||
return $groupFolderPath . '/' . $fileName;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->StoragePath = GROCY_DATAPATH . '/storage';
|
||||
|
||||
if (!file_exists($this->StoragePath))
|
||||
{
|
||||
mkdir($this->StoragePath);
|
||||
}
|
||||
|
||||
if (GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
|
||||
{
|
||||
$dbSuffix = GROCY_DEFAULT_LOCALE;
|
||||
if (defined('GROCY_DEMO_DB_SUFFIX'))
|
||||
{
|
||||
$dbSuffix = GROCY_DEMO_DB_SUFFIX;
|
||||
}
|
||||
|
||||
$this->StoragePath = $this->StoragePath . '/' . $dbSuffix;
|
||||
|
||||
if (!file_exists($this->StoragePath))
|
||||
{
|
||||
mkdir($this->StoragePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user