function _responsive_image_image_style_url

_responsive_image_image_style_url($style_name, $path)

Wrapper around image_style_url() so we can return an empty image.

File

core/modules/responsive_image/responsive_image.module, line 492
Responsive image display formatter for image fields.

Code

function _responsive_image_image_style_url($style_name, $path) {
  if ($style_name == RESPONSIVE_IMAGE_EMPTY_IMAGE) {
    // The smallest data URI for a 1px square transparent GIF image.
    // http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
    return 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
  }
  $entity = ImageStyle::load($style_name);
  if ($entity instanceof ImageStyle) {
    return file_url_transform_relative($entity->buildUrl($path));
  }
  return file_url_transform_relative(file_create_url($path));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!responsive_image!responsive_image.module/function/_responsive_image_image_style_url/8.1.x