function image_style_path
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
9 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.
- ImageStylesHTTPHeadersTestCase::_testImageStyleUrlAndPath in modules/
image/ image.test - Function to scale and test.
- ImageStylesPathAndUrlTestCase::testImageStylePath in modules/
image/ image.test - Test image_style_path().
- ImageStylesPathAndUrlTestCase::_testImageStyleUrlAndPath in modules/
image/ image.test - Test image_style_url().
File
-
modules/
image/ image.module, line 1175
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.