title: Facebook GRAPH API + PHP SDK: get the URL of the large user picture
body: <p>I'm trying to rewrite a Facebook app (a PHP script embedding <a href="http://apps.facebook.com/video-preferans/" rel="nofollow">a small multiplayer Flash game</a>) from old FBML to new iFrame type and it kind of works:</p>
  
  <pre><code>&lt;?php
  
  require_once('facebook.php');
  
  define('FB_API_ID', '182820975103876');
  define('FB_AUTH_SECRET', 'XXX');
  
  $facebook = new Facebook(array(
              'appId'  =&gt; FB_API_ID,
              'secret' =&gt; FB_AUTH_SECRET,
              'cookie' =&gt; true,
              ));
  
  if (! $facebook-&gt;getSession()) {
      printf('&lt;script type="text/javascript"&gt;top.location.href="%s";&lt;/script&gt;',
          $facebook-&gt;getLoginUrl(
                  array('canvas'    =&gt; 1,
                        'fbconnect' =&gt; 0,
                        #'req_perms' =&gt; 'user_location',
          )));
  
  } else {
      try {
          $me = $facebook-&gt;api('/me');
  
          $first_name = $me['first_name'];
          $city       = $me['location']['name'];
          $female     = ($me['gender'] != 'male');
          $fields     = $facebook-&gt;api('/me', array(
                            'fields' =&gt; 'picture',
                            'type'   =&gt; 'large'
                        ));
          $avatar     = $fields['picture'];
  
          # then I print swf tag and pass first_name;city;avatar to it
  
      } catch (FacebookApiException $e) {
          print('Error: ' . $e);
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>but I think that the call to get the user profile picture causes my script to perform a 2nd CURL fetch, which is probably avoidable? And also I'd like to use the new GRAPH API and not the old REST API - but I'm not sure how to rewrite that call (and I need to get the <strong>large</strong> and <strong>direct</strong> user picture).</p>