コード例 #1
0
ファイル: helper_image.php プロジェクト: proyectoseb/Matrix
 public function initCache($options = array())
 {
     $private_cache = array_key_exists('cache', $options) ? $options['cache'] : null;
     $private_cache_url = array_key_exists('cache_url', $options) ? $options['cache_url'] : null;
     if (empty($private_cache)) {
         if (is_null(ImageHelper::$cache) && defined('JPATH_CACHE')) {
             ImageHelper::$cache = JPATH_CACHE . '/resized';
             if (!file_exists(ImageHelper::$cache)) {
                 if (!@mkdir(ImageHelper::$cache, 0755, true)) {
                     ImageHelper::$cache = null;
                 }
             }
         }
         if (is_null(ImageHelper::$cache)) {
             ImageHelper::$cache = dirname(__FILE__) . '/resized';
             if (!file_exists(ImageHelper::$cache)) {
                 if (!@mkdir(ImageHelper::$cache, 0755, true)) {
                     ImageHelper::$cache = null;
                 }
             }
         }
         if (is_null(ImageHelper::$cache)) {
             $this->errors[] = 'Can not create cache folder!';
         } else {
             $private_cache = ImageHelper::$cache;
         }
     }
     if (empty($private_cache_url)) {
         if (empty($private_cache)) {
             // noop
         } else {
             $private_cache_url = $this->jpath2url($private_cache);
         }
     }
     $this->out['cache'] = $private_cache;
     $this->out['cache_url'] = $private_cache_url;
 }