You are here

function _image_ncck_flickr_guess_size in Embedded Media Field 5

Helper function for _image_ncck_flickr_image_url. This will return the appropriate array key for the image size we wish.

1 call to _image_ncck_flickr_guess_size()
image_ncck_flickr_image_url in contrib/image_ncck/providers/flickr.inc
implement image_ncck_PROVIDER_image_url

File

contrib/image_ncck/providers/flickr.inc, line 226

Code

function _image_ncck_flickr_guess_size($width, $height) {
  $max = max($width, $height);
  if ($max) {
    foreach (array(
      '0' => 75,
      '1' => 100,
      '2' => 240,
      '3' => 500,
      '4' => 1024,
    ) as $size => $value) {
      if ($max <= $value) {
        return $size;
      }
    }
  }

  // If we don't have width or height set, then get the original size.
  return '5';
}