function _picture_image_style_url in Picture 7.2
Same name and namespace in other branches
- 7 picture.module \_picture_image_style_url()
Wrapper around image_style_url() so we can return an empty image.
3 calls to _picture_image_style_url()
- theme_picture in ./
picture.module - Returns HTML for a picture.
- theme_picture_sizes_formatter in ./
picture.module - Theme pictue sizes formatter.
- _picture_filter_prepare_image in ./
picture.module - Prepares a Render Array for theme_picture_formatter().
File
- ./
picture.module, line 2154 - Picture formatter.
Code
function _picture_image_style_url($style_name, $path, $timestamp = NULL) {
if ($style_name == PICTURE_EMPTY_IMAGE) {
return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
}
if ($style_name == PICTURE_ORIGINAL_IMAGE) {
$url = file_create_url($path);
}
else {
$url = image_style_url($style_name, $path);
}
$token_query = array();
if (!empty($timestamp) && !variable_get('image_suppress_itok_output', FALSE)) {
$token_query['timestamp'] = $timestamp;
}
// Allow modules to alter the $token_query for the given style.
$context = array(
'uri' => $url,
'style_name' => $style_name,
'path' => $path,
);
drupal_alter('image_style_uri_token_query', $token_query, $context);
// Append the query string with the token, if necessary.
if ($token_query) {
$url .= (strpos($url, '?') !== FALSE ? '&' : '?') . drupal_http_build_query($token_query);
}
return $url;
}