You are here

protected function FocalPointPreviewController::buildUrl in Focal Point 8

Create the URL for a preview image including a query parameter.

Parameters

\Drupal\image\ImageStyleInterface $style: The image style being previewed.

\Drupal\file\Entity\File $image: The image being previewed.

string $focal_point_value: The focal point being previewed in the format XxY where x and y are the left and top offsets in percentages.

Return value

\Drupal\Core\GeneratedUrl|string The URL of the preview image.

1 call to FocalPointPreviewController::buildUrl()
FocalPointPreviewController::content in src/Controller/FocalPointPreviewController.php

File

src/Controller/FocalPointPreviewController.php, line 246

Class

FocalPointPreviewController
Class FocalPointPreviewController.

Namespace

Drupal\focal_point\Controller

Code

protected function buildUrl(ImageStyleInterface $style, File $image, $focal_point_value) {
  $url = $style
    ->buildUrl($image
    ->getFileUri());
  $url .= (strpos($url, '?') !== FALSE ? '&' : '?') . 'focal_point_preview_value=' . $focal_point_value;
  return $url;
}