1 image.module 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



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


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;