You are here

function emimage_flickr_image_url in Embedded Media Field 6

Implements emimage_PROVIDER_image_url.

Parameters

$code: The provider code of the image. @param $width @param $height The dimensions of the photo to display. @return The url directly to the image to display.

2 calls to emimage_flickr_image_url()
emimage_flickr_import in contrib/emimage/providers/flickr.inc
This allows flickr photosets to be imported into nodes
emimage_flickr_thumbnail in contrib/emimage/providers/flickr.inc

File

contrib/emimage/providers/flickr.inc, line 226
This include processes flickr.com image files for use by emfield.module.

Code

function emimage_flickr_image_url($code, $width, $height, $formatter = NULL, $field = NULL, $item = NULL, $node = NULL) {
  if ($code) {
    $size = _emimage_flickr_guess_size($width, $height);
    $getsize = emimage_flickr_request('flickr.photos.getSizes', array(
      'photo_id' => $code,
    ));

    // For small images, there may not be the sizes 0..4 that
    // _emimage_flickr_guess_size assumes, so:
    $size = min($size, count($getsize['sizes']['size']) - 1);
    $url = $getsize['sizes']['size'][$size]['source'];
  }
  return $url;
}