function image_style_path

Return the URI of an image when using a 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.

Parameters

$style_name: The name of the style to be used with this image.

$uri: The URI or path to the image.

Return value

The URI to an image style image.

See also

image_style_url()

6 calls to image_style_path()
FileMoveTest::testNormal in drupal/core/modules/system/lib/Drupal/system/Tests/Image/FileMoveTest.php
Tests moving a randomly generated image.
ImageStylesPathAndUrlTest::testImageStylePath in drupal/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
Test image_style_path().
image_path_flush in drupal/core/modules/image/image.module
Clear cached versions of a specific file in all styles.
image_style_deliver in drupal/core/modules/image/image.module
Menu callback; Given a style and image path, generate a derivative.
image_style_url in drupal/core/modules/image/image.module
Return the URL for an image derivative given a style and image path.

... See full list

File

drupal/core/modules/image/image.module, line 884
Exposes global functionality for creating image styles.

Code

function image_style_path($style_name, $uri) {
  $scheme = file_uri_scheme($uri);
  if ($scheme) {
    $path = file_uri_target($uri);
  }
  else {
    $path = $uri;
    $scheme = file_default_scheme();
  }
  return $scheme . '://styles/' . $style_name . '/' . $scheme . '/' . $path;
}