You are here

public function Photos::photoGetSize in Flickr 8

Get Photo Size.

Parameters

string $photoId: Photo ID.

string $size: Size.

Return value

bool|array False or array.

1 call to Photos::photoGetSize()
Photos::themePhoto in src/Service/Photos.php
Theme Photos.

File

src/Service/Photos.php, line 172

Class

Photos
Class Photos.

Namespace

Drupal\flickr\Service

Code

public function photoGetSize($photoId, $size) {
  $photoSizes = $this->flickrApiPhotos
    ->photosGetSizes($photoId);
  $sizes = $this->flickrApiHelpers
    ->photoSizes();
  $label = $sizes[$size]['label'];
  foreach ($photoSizes as $size) {
    if ($size['label'] == $label) {
      $size['width'] = (int) $size['width'];
      $size['height'] = (int) $size['height'];
      $size['aspect'] = $this
        ->photoCalculateAspectRatio($size['width'], $size['height']);
      return $size;
    }
  }
  return FALSE;
}