You are here

public function ImageStyle::buildUri in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/src/Entity/ImageStyle.php \Drupal\image\Entity\ImageStyle::buildUri()

Returns the URI of this image when using this style.

The path returned by this function may not exist. The default generation method only creates images when they are requested by a user's browser. Modules may implement this method to decide where to place derivatives.

Parameters

string $uri: The URI or path to the original image.

Return value

string The URI to the image derivative for this style.

Overrides ImageStyleInterface::buildUri

2 calls to ImageStyle::buildUri()
ImageStyle::buildUrl in core/modules/image/src/Entity/ImageStyle.php
Returns the URL of this image derivative for an original image path or URI.
ImageStyle::flush in core/modules/image/src/Entity/ImageStyle.php
Flushes cached media for this style.

File

core/modules/image/src/Entity/ImageStyle.php, line 179
Contains \Drupal\image\Entity\ImageStyle.

Class

ImageStyle
Defines an image style configuration entity.

Namespace

Drupal\image\Entity

Code

public function buildUri($uri) {
  $scheme = $this
    ->fileUriScheme($uri);
  if ($scheme) {
    $path = $this
      ->fileUriTarget($uri);
  }
  else {
    $path = $uri;
    $scheme = $this
      ->fileDefaultScheme();
  }
  return $scheme . '://styles/' . $this
    ->id() . '/' . $scheme . '/' . $this
    ->addExtension($path);
}