public static function init()
 {
     self::$cacheDir = '../../../' . Config::$cache_folder . '/images';
     self::$documentRoot = '../../..';
     // This must be the last line of this function
     parent::init();
 }
Exemple #2
0
 public static function init()
 {
     parent::init();
     self::$enableRequestCache = (bool) IMAGE::$config['cache'];
     self::$defaultImagePath = (string) IMAGE::$config['defaultImage'];
     self::$defaultQuality = (int) IMAGE::$config['defaultQuality'];
     self::$browserCacheTTL = (int) IMAGE::$config['browserCacheLifetime'];
     self::$garbageCollectFileCacheMaxLifetime = (int) IMAGE::$config['serverCacheLifetime'];
     self::$cacheDir = (string) IMAGE::$config['cacheDir'];
     self::$pathToCacheDir = (string) IMAGE::$config['pathToCacheDir'];
     if (!is_dir(self::$pathToCacheDir)) {
         $cachePath = explode('/', self::$cacheDir);
         $count = count($cachePath);
         $currentPath = IMAGE::$config['documentRoot'];
         for ($i = 0; $i < $count; $i++) {
             if ($cachePath[$i] !== '') {
                 $currentPath = $currentPath . '/' . $cachePath[$i];
                 if (!is_dir($currentPath)) {
                     mkdir($currentPath);
                 }
             }
         }
         chmod(self::$pathToCacheDir, 0777);
     }
 }