Beispiel #1
0
 public function link_resource($type, $name)
 {
     return \System\Resource::get_url('static', $type, $name);
 }
Beispiel #2
0
 public function run()
 {
     $this->flow->redirect(\System\Resource::get_url('media', 'schema', $this->name));
 }
Beispiel #3
0
 public function url()
 {
     return \System\Resource::get_url('media', 'thumb', $this->hash() . '.' . $this->image->suffix());
 }
Beispiel #4
0
 public function to_object()
 {
     if (!$this->mime) {
         $this->read_meta();
     }
     $path = str_replace(\System\File::DIR, '', $this->get_path_relative());
     $src = 'media';
     $cname = $this::RESOURCE_CNAME;
     $stat = $cname::DIR_STATIC;
     try {
         $cache = \System\Settings::get('cache', 'resources');
     } catch (\System\Error $e) {
         $cache = false;
     }
     if ($cache) {
         $dirs = array($stat);
     } else {
         $dirs = \System\Composer::list_dirs($stat);
         array_unshift($dirs, $stat);
     }
     foreach ($dirs as $dir) {
         if (strpos($path, $dir) === 0 || strpos($path, $dir = substr($dir, 1)) === 0) {
             $path = substr($path, strlen($dir));
             $src = 'static';
             break;
         }
     }
     $url = \System\Resource::get_url($src, self::RESOURCE_TYPE, preg_replace("/^\\//", '', $path));
     return array("url" => $url, "path" => $path, "name" => $this->name, "mime" => $this->mime, "size" => $this->size, "method" => $this->method ? $this->method : 'save');
 }