title: How to convert url image into base64 using Vue
body: <p>I'm trying to convert a image url from facebook login. I'd like to this task using Vue.</p>
  
  <pre><code>    getDataUri(url, callback){
            let image = new Image()
  
            image.onload = () =&gt; {
                let canvas = document.createElement('canvas');
                canvas.width = this.naturalWidth
                canvas.height = this.naturalHeight
                canvas.getContext('2d').drawImage(this, 0, 0)
                callback(canvas.toDataUrl('image/png').replace(/^data:image\/(png|jpg);base64,/, ''))
                callback(canvas.toDataURL('image/png'))
            }
  
            image.src = url
        },
  
    retrivePhoto(id){
      FB.api('/'+id+'/picture?redirect=false&amp;height=120&amp;width=120','GET',{},
        function(response) {
          console.log(this.getDataUri(response.data.url));
        });
      },
  </code></pre>
  
  <p>When I tried to run the code, I got this javascript error </p>
  
  <blockquote>
    <p>all.js:108 Uncaught TypeError: this.getDataUri is not a function</p>
  </blockquote>