20, 'sort' => 'relevance', 'extras' => 'license,owner_name,tags', 'license' => @$_REQUEST['flkLicense'] ? $_REQUEST['flkLicense'] : flickr_get_default_usage_id(), ); if(@$_REQUEST['flkSearch']) { $opts['text'] = $_REQUEST['flkSearch']; } if(@$_REQUEST['flkUsername']) { $user_id = flickr_get_user_id($_REQUEST['flkUsername']); if($user_id) { $opts['user_id'] = $user_id; } } $data = flickr_request('flickr.photos.search', $opts); $records = $data['photos']['photo']; // For future purposes, we may want an image manager $relative = '/'; $manager = new ImageManager($IMConfig); /* ================= OUTPUT/DRAW FUNCTIONS ======================= */ function rip_flickr_data($record) { $lics = flickr_get_licenses(); // echo '
'; print_r($lics);  die();
  
  $title = $record['title'];
  $license = $lics[$record['license']];
  
  // echo '
';print_r($license); die();
  
  $description = '';
  $sizes = flickr_request('flickr.photos.getSizes', array('photo_id' => $record['id']));
  $sizes = $sizes['sizes'];
  $thumbs = array(); // w:h => array( file, file, file)
  $largest = array(0,'', 0, 0);   
  $smallest = array(3000*3000,'', 3000, 3000); // Ok, hacky, sosumi
  
  foreach($sizes['size'] as $thumb) 
  {
    if($thumb['label'] == 'Square') continue; // These are a little smaller than default
    if(!isset($thumbs["{$thumb['width']}x{$thumb['height']}"]))
    {
      $thumbs["{$thumb['width']}x{$thumb['height']}"]  = array();
      
      if(($thumb['width'] * $thumb['height']) > $largest[0])
        $largest = array($thumb['width'] * $thumb['height'], $thumb['width'] . 'x' . $thumb['height'], $thumb['width'] , $thumb['height']);
      
      if(($thumb['width'] * $thumb['height']) < $smallest[0])
        $smallest = array($thumb['width'] * $thumb['height'], $thumb['width'] . 'x' . $thumb['height'], $thumb['width'] , $thumb['height']);
    }
    $thumbs["{$thumb['width']}x{$thumb['height']}"][] = $thumb;
    
  }

  // Find the main image link
  $mainImage = $thumbs[$largest[1]];
  $mainImage = array_pop($mainImage);
  
  // Find the thumb image link
  $thumbImage = $thumbs[$smallest[1]];
  $thumbImage = array_pop($thumbImage);
  
  // Final image to pass to manager (use query param to record the embed url)
  $combinedImage = $mainImage['source'] . 
  '?x-flickr-photo='.rawurlencode($record['id']) .
  '&x-lic='.rawurlencode($license['x-id'])   .
  '&x-uid='.rawurlencode($record['owner'])       .  
  '&x-by='.rawurlencode($record['ownername'])    .   
  '&x-tn='.rawurlencode($thumbImage['source']);
  
  
  return array
  (
   'title'         => $title,
   'description'   => $description,
   'dimensions'    => "{$mainImage['width']}x{$mainImage['height']}",
   'license'       => $license,
   'mainImage'     => $mainImage['source'],
   'thumbImage'    => $thumbImage['source'],
   'combinedImage' => $combinedImage,
   
   'smallest' => $smallest,
   'largest'  => $largest,
   'thumbs'   => $thumbs,   
  );
}
                           
function drawFiles($list, &$manager)
{
	global $relative;
	global $IMConfig;
$IMConfig['ViewMode'] = 'thumbs';
    switch($IMConfig['ViewMode'])
    {
      case 'details':
      {
        
        ?>
        
        
TitleDescriptionDimensions
No Photos Found
Invalid base directory: config['images_dir']; ?>
Flickr Picture List isValidBase() == false) { drawErrorBase($manager); } elseif(count($records)) { ?>