public function Helpers::photoImgUrl in Flickr API Integration 8
Returns the URL to $photo.
With size $size using the correct image farm from the $photo variable.
Parameters
string $photo: Photo to which the url should point.
string $size: Size of the photo.
string $format: Format of the photo.
Return value
array URL for $photo with the correct size and format.
File
- src/
Service/ Helpers.php, line 171
Class
- Helpers
- Class Helpers.
Namespace
Drupal\flickr_api\ServiceCode
public function photoImgUrl($photo, $size = NULL, $format = NULL) {
// Early images don't have a farm setting so default to 1.
$farm = isset($photo['farm']) ? $photo['farm'] : 1;
$server = $photo['server'];
// photoset's use primary instead of id to specify the image.
$id = isset($photo['primary']) ? $photo['primary'] : $photo['id'];
$secret = $photo['secret'];
$suffix = $size ? "_{$size}." : '.';
$suffix = $size == '-' ? '.' : $suffix;
$extension = $size == 'o' ? $format : 'jpg';
return "https://farm{$farm}.static.flickr.com/{$server}/{$id}_{$secret}" . $suffix . $extension;
}