You are here

function flickr_photo_img in Flickr 6

Same name and namespace in other branches
  1. 5 flickr.inc \flickr_photo_img()
  2. 7 flickr.inc \flickr_photo_img()

Create the url to $photo with size $size using the correct image farm from the $photo variable.

Parameters

$photo: photo to which the url should point

$size: size of the photo

$format: format of the photo

Return value

url for $photo with the correct size and format

4 calls to flickr_photo_img()
flickr_img in ./flickr.inc
This function will try to create a html image tag referencing the Flickr photo with the desired size if that size is available for this photo.
theme_flickrfield_photo in field/flickrfield.module
Flickrfield photo themes.
theme_flickrfield_photoset in field/flickrfield.module
theme_flickr_photo in ./flickr.module

File

./flickr.inc, line 184

Code

function flickr_photo_img($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'];
  return "https://farm{$farm}.static.flickr.com/{$server}/{$id}_{$secret}" . ($size ? "_{$size}." : '.') . ($size == 'o' ? $format : 'jpg');
}