You are here

function flickr_photo_img in Flickr 5

Same name and namespace in other branches
  1. 6 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

1 call 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.

File

./flickr.inc, line 212

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