You are here

function _emimage_flickr_guess_size in Embedded Media Field 6

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

1 call to _emimage_flickr_guess_size()
emimage_flickr_image_url in contrib/emimage/providers/flickr.inc
Implements emimage_PROVIDER_image_url.

File

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

Code

function _emimage_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';
}