You are here

function media_flickr_guess_size in Media: Flickr 6

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

2 calls to media_flickr_guess_size()
media_flickr_xspf_page in contrib/media_flickr_xspf/media_flickr_xspf.module
Page callback for /media/flickr/[photoset]/xspf.
_media_flickr_photo_url in ./media_flickr.utilities.inc
Based on the Photo ID of a Flickr image, this will return the URL to the image itself.

File

./media_flickr.module, line 154
Embedded Video Field provider file for Flickr.com photosets.

Code

function media_flickr_guess_size($width = 0, $height = 0) {
  $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';
}