public static function Blazy::imageUrl in Blazy 7
Provides image url based on the given settings.
1 call to Blazy::imageUrl()
- Blazy::urlAndDimensions in src/
Blazy.php
File
- src/
Blazy.php, line 66
Class
- Blazy
- Implements BlazyInterface.
Namespace
Drupal\blazyCode
public static function imageUrl(array &$settings, $item = NULL) {
// Provides image URL expected by lazy load.
$uri = $settings['uri'];
if ($settings['image_style']) {
$settings['image_url'] = image_style_url($settings['image_style'], $uri);
// Only re-calculate dimensions if not cropped, nor already set once.
if (empty($settings['_dimensions'])) {
$settings = array_merge($settings, self::transformDimensions($settings['image_style'], $item));
}
}
else {
$image_url = file_valid_uri($uri) ? file_create_url($uri) : $uri;
$settings['image_url'] = $settings['image_url'] ?: $image_url;
}
// Just in case, an attempted kidding gets in the way, relevant for UGC.
$data_uri = !empty($settings['use_data_uri']) && substr($settings['image_url'], 0, 10) === 'data:image';
if (!empty($settings['_check_protocol']) && !$data_uri) {
$settings['image_url'] = drupal_strip_dangerous_protocols($settings['image_url']);
}
}