You are here

public function ImageStyleDownloadController::lookupSourceImage in ImageAPI Optimize WebP 2.x

Same name and namespace in other branches
  1. 8 src/Controller/ImageStyleDownloadController.php \Drupal\imageapi_optimize_webp\Controller\ImageStyleDownloadController::lookupSourceImage()

Lookup potential source files based on webp uri.

Parameters

string $image_uri: The webp image uri.

Return value

mixed|null The source image uri.

1 call to ImageStyleDownloadController::lookupSourceImage()
ImageStyleDownloadController::deliver in src/Controller/ImageStyleDownloadController.php
Generates a derivative, given a style and image path.

File

src/Controller/ImageStyleDownloadController.php, line 26

Class

ImageStyleDownloadController
Defines a controller to serve image styles.

Namespace

Drupal\imageapi_optimize_webp\Controller

Code

public function lookupSourceImage($image_uri) {
  $source_image = substr($image_uri, 0, strrpos($image_uri, "."));
  if ($source_image . '.webp' === $image_uri) {
    return $source_image;
  }
}