1. drupal
    1. 8
    2. 7
7 – 8 image_style_path($style_name, $uri)

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.


$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


▾ 6 functions call image_style_path()

ImageFieldDisplayTestCase::_testImageFieldFormatters in modules/image/image.test
Test image formatters on node display.
ImageStylesPathAndUrlUnitTest::testImageStylePath in modules/image/image.test
Test image_style_path().
image_path_flush in modules/image/image.module
Clear cached versions of a specific file in all styles.
image_style_deliver in modules/image/image.module
Menu callback; Given a style and image path, generate a derivative.
image_style_url in modules/image/image.module
Return the URL for an image derivative given a style and image path.
theme_image_style_preview in modules/image/
Returns HTML for a preview of an image style.


modules/image/image.module, line 887

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;