Do you know how to import picture from Facebook, to the main profile of Profile2?

I used 'Facebook OAuth Profile2 Integration', but there is no option to import picture to Profile2.

Any suggestions?

Comments

mrded’s picture

Title: Picture prom Facebook to Profile2 » Profile picture from Facebook
Version: 7.x-1.6 » 7.x-1.x-dev
Component: Miscellaneous » Code
Category: support » feature
Status: Active » Needs review
StatusFileSize
new2.14 KB

This patch will add integration with profile picture.

joco_sp’s picture

I applied the patch, but now I'm getting this error:

'Warning: file_get_contents(http://graph.facebook.com/118xxxxxxx/picture?width=1000) [function.file-get-contents]: failed to open stream: Connection timed out in fboauth_field_convert_image() (line 219 of /home/user/domains/example.com/public_html/sites/all/modules/fboauth/includes/fboauth.field.inc).'

I can see the name of picture in the 'Profile_pictures' folder, but it has 0 KB size.

mrded’s picture

StatusFileSize
new2.17 KB

Try this patch

joco_sp’s picture

With the new patch I get the same error, but now I can't even see the name of the picture in my 'Profile_pictures' folder.

Maybe there's a problem with the permissions to get the user picture from Facebook.

I also tried to import Facebook picture to the built-in user picture and I get the error (I ceked the box in 'Basic mapping'):

'Notice: Undefined property: stdClass::$data in fboauth_create_user() (line 262 of /home/user/domains/example.com/public_html/sites/all/modules/fboauth/includes/fboauth.fboauth.inc).'

It would be nice if someone else try the patch. Maybe its only me to get this error?

imoreno’s picture

#3 does not work for me, no errors, but picture is not imported.

mrded’s picture

StatusFileSize
new325.85 KB

Just to be clear. This patch will not import Facebook picture to $user->picture

This patch will provide additional "Profile picture" option for image's fields.
And you can choose it from Facebook OAuth Profile2 Integration module's settings. (See screenshot)

imoreno’s picture

Is there a way to use profile2 integration without display the profile fields on user login form?

mrded’s picture

joco_sp’s picture

Ok, the #1 and #3 worked for me. Now we only have to import them. I found this site, I'll try to do it
http://www.grasmash.com/article/connecting-facebook-drupal-easy-way-part-2

imoreno’s picture

currently, both #7 and #9 are not a valid solution. maybe I'm missing something.

mrded’s picture

@imoreno, if you you want to import picture to $user->picture - this solution is not valid for you. Check #6

ace11’s picture

Nice! #3 works like a charm.

Barto.G’s picture

Issue summary: View changes

Here is my 2 cents

At first the patch #3 did not work. I got the same as #joco (file_get_contents timed out).
Then i changed the width of file request from "1000" to "300" in

if ($image = file_get_contents("http://graph.facebook.com/$fbuser->id/picture?width=1000")) { 

My field only allow for files smaller than 500X500 pixels.

Second test worked perfectly
Thanks for the patch

mrded’s picture

Anonymous’s picture

How to I fix the following error message?

Error message
The specified file temporary://fileTNxt63 could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.

bibishani’s picture

Hi, superduperdan.
You can fix this error if replace this lines :

$destination = file_field_widget_uri($field, $instance) . "/$fbuser->id.jpg";
$file = file_save_data($image, $destination, FILE_EXISTS_REPLACE);
with :
$directory = file_default_scheme() . '://' . variable_get('user_picture_path', 'pictures');
$file = file_save_data($image, $picture_directory, FILE_EXISTS_RENAME);

darrellduane’s picture

Could someone provide a patch file? At a quick glance I'm not sure which file these changes are for.

AlexKirienko’s picture

StatusFileSize
new2.35 KB

Hi, DarrellDuane.

Please check this patch based on #3.

Patch #3 was updated to use fboauth_graph_query and support latest changes in dev version (v2+ FB API)

darrellduane’s picture

Ok, I'll incorporate this patch instead for the Profile Picture integration.

darrellduane’s picture

Status: Needs review » Patch (to be ported)

OK, this has been added to the latest development version. Sorry I wasn't able to add in the right commit options this time.

khoomy’s picture

Hi DarrellDuane

I am still facing an issue when using Amazon S3 file system.

It shows
File temporary://file7kmIXk could not be copied, because the destination directory s3://users/2016/05/08 is not configured correctly.

khoomy’s picture

StatusFileSize
new1.01 KB

Hi DarrellDuane

Here is a patch which fix the issue for S3 File system.

Cheers