title: getting image from link in javascript
body: <p>I have a link to an image an I would like to save it as an image.
  For example the link is <a href="http://graph.facebook.com/sarfraz.anees/picture" rel="nofollow">http://graph.facebook.com/sarfraz.anees/picture</a>. How do I save this into an image variable in javascript so I can use it to do:</p>
  
  <pre><code>document.write("&lt;img src=\"" + pic + "\" class=\"avatar\"&gt;")
  </code></pre>
  
  <p>also would be very useful if someone can guide me on how to resize this image to a 50x50.
  Here's my latest code</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>&lt;body id="suggestions" class="default verified "&gt;
      &lt;div id="fb-root"&gt;&lt;/div&gt;
      &lt;script type="text/javascript"&gt;
              FB.init({appId: '1355709392349404', status: true, cookie: true, xfbml: true});
              FB.getLoginStatus(function(response) {
                if (response.session) {
                  pic = "http://graph.facebook.com/" + response.session.uid + "/picture";
                } else {
                  window.location = "index.php"
                }
              });
      &lt;/script&gt;
      &lt;div class="clearfix" id="wrap"&gt;
          &lt;div id="nav"&gt;
              &lt;div class="center clearfix"&gt;
                  &lt;h5&gt;
                      &lt;a href="/main.php"&gt;Favor&lt;/a&gt;
                  &lt;/h5&gt;
                  &lt;ul class="icons menu clearfix"&gt;
                      &lt;li&gt;
                          &lt;a title="You" href="/me"&gt;
                              &lt;script type="text/javascript"&gt;
                                  document.write("&lt;img src=\"" + pic + "\" class=\"avatar\"&gt;");
                              &lt;/script&gt;
                          &lt;/a&gt;
                      &lt;/li&gt;
  </code></pre>
  
  <p>Issue is that I can't get the pic that is on the other script</p>