You are here

public function PhotosImage::url in Album Photos 8.5

Same name and namespace in other branches
  1. 8.4 src/PhotosImage.php \Drupal\photos\PhotosImage::url()

Return URL to image file.

@note this is not currently in use.

File

src/PhotosImage.php, line 162

Class

PhotosImage
Create images object.

Namespace

Drupal\photos

Code

public function url($uri, $style_name = 'thumbnail') {
  if ($style_name == 'original') {
    $image_styles = image_style_options(FALSE);
    if (isset($image_styles['photos_original'])) {
      $image_url = ImageStyle::load($style_name)
        ->buildUrl($uri);
    }
    else {
      $image_url = file_create_url($uri);
    }
  }
  else {
    $image_url = ImageStyle::load($style_name)
      ->buildUrl($uri);
  }
  return $image_url;
}