-2

I need to get the picture of the profile of facebook and convert to Base64. The version of PHP is 5.2.17 and I cannot use the last SDK.

I can login, get the picture and show it with this:

src="https://graph.facebook.com/$id/picture?type=large">

I´ve tried to save a copy of the image with this example: file_get_contents() and Curl, the url of the image is correct.

This is the url: https://scontent.xx.fbcdn.net/v/t1.0-1/p200x200/16195072_104262870090313_5077585589040998026_n.jpg?oh=xxxxx&oe=xxxxx

I would like to convert this image in base64.

Could someone show me how can I do it?

Community
  • 1
  • 1
user1253414
  • 249
  • 1
  • 8
  • 17

1 Answers1

0

You need the base64_encode function: http://php.net/manual/en/function.base64-encode.php

Oliver
  • 893
  • 6
  • 17
  • I know this function, and I´ve used with local image, but my problem is to get facebook picture and use this function. – user1253414 Jan 31 '17 at 15:56
  • copy the image with copy-function: copy("http://facebook/imageurl","/server/path/tmp.jpg"); and then you can encode the image – Oliver Jan 31 '17 at 16:02