You are here

public function Local::getExternalUrl in Flysystem 8

Same name and namespace in other branches
  1. 7 src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::getExternalUrl()
  2. 3.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::getExternalUrl()
  3. 2.0.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::getExternalUrl()
  4. 3.0.x src/Flysystem/Local.php \Drupal\flysystem\Flysystem\Local::getExternalUrl()

Returns a web accessible URL for the resource.

This function should return a URL that can be embedded in a web page and accessed from a browser. For example, the external URL of "youtube://xIpLd0WQKCY" might be "http://www.youtube.com/watch?v=xIpLd0WQKCY".

Parameters

string $uri: The URI to provide a URL for.

Return value

string Returns a string containing a web accessible URL for the resource.

Overrides FlysystemPluginInterface::getExternalUrl

File

src/Flysystem/Local.php, line 93

Class

Local
Drupal plugin for the "Local" Flysystem adapter.

Namespace

Drupal\flysystem\Flysystem

Code

public function getExternalUrl($uri) {
  if ($this->isPublic === FALSE) {
    return $this
      ->getDownloadlUrl($uri);
  }
  $path = str_replace('\\', '/', $this->root . '/' . $this
    ->getTarget($uri));
  return $GLOBALS['base_url'] . '/' . UrlHelper::encodePath($path);
}