public function link_resource($type, $name) { return \System\Resource::get_url('static', $type, $name); }
public function run() { $this->flow->redirect(\System\Resource::get_url('media', 'schema', $this->name)); }
public function url() { return \System\Resource::get_url('media', 'thumb', $this->hash() . '.' . $this->image->suffix()); }
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'); }