You are here

function image_style_path in Drupal 7

Returns 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()

8 calls to image_style_path()
ImageFileMoveTest::testNormal in modules/simpletest/tests/image.test
Tests moving a randomly generated image.
ImageStyleFlushTest::createSampleImage in modules/image/image.test
Given an image style and a wrapper, generate an image.
ImageStylesPathAndUrlTestCase::testImageStylePath in modules/image/image.test
Test image_style_path().
ImageStylesPathAndUrlTestCase::_testImageStyleUrlAndPath in modules/image/image.test
Test image_style_url().
image_path_flush in modules/image/image.module
Clears cached versions of a specific file in all styles.

... See full list

File

modules/image/image.module, line 1096
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;
}