Hi ,
I have tried Rpx Import profile picture, But when i linked to my facebook account , My face book image is not copied to the drupal user image, When i traced back i could see that the image is not copied to the tmp location.
I have changed the line
copy($photo_url, $tmp_photo);
to
if (!copy($photo_url, $tmp_photo)) {
drupal_set_message(t('Failed to copy user image') .' '. $tmp_photo);
}
to identify the issue.
The tmp dir is "/tmp/1302837559.image"
Operating System:Ubuntu 10.12
Should I have to configure any thing or give permissions to write, Why can the image copied to files directory?
Regards,
Dinesh.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | fix-download-1127974-8.diff | 592 bytes | j0rd |
Comments
Comment #1
parrottvision commentedsame issue here.
Comment #2
geokat commentedDoes uploading user pictures work?
Can you add a picture to your new Drupal account in the user settings Edit section?
Comment #3
parrottvision commentedtwitter photos import OK but facebook don't. I can upload a user photo through usual Drupal edit user.
Comment #4
Dinesh Kumar Sarangapani commentedYes, I was able to upload drupal user picture before, But Now I can't. I will try to remove rpx and try and get back to you.
Comment #5
Dinesh Kumar Sarangapani commentedComment #6
geokat commentedComment #7
__Sander__ commentedDoes not work for me for Google profile
Comment #8
j0rd commentedThere a problem with the facebook import on the 7.x Drupal version.
Here's the issue with facebook. It can semi-easily get fixed. Might be a similar issue with other providers.
Here's the error:
The imported facebook image URL looks like this
This is a redirect to an actual JPG, but this URL is not. The spider you have in the RPX code needs to follow the redirect. Currently RPX is simply using PHP's copy() to pull in the file. I've changed the code to use proper drupal functions for download. Supplied is the patch for the 7.x-2.0 version of rpx. This will need to get back ported to Drupal 6 & upstreamed to 7.x-2.1
Comment #9
geokat commentedI have no problem to change copy() to system_retrieve_file(), since the
latter is probably the preferred way of doing this in Drupal.
However, I can't reproduce the issue. For example, this URL
http://graph.facebook.com/100001330711472/picture?type=large is
handled fine. And yours resolves the same way as this one, therefore I
don't see why yours should create any problems.
Besides, system_retrieve_file() is not available in Drupal 6.
Comment #10
j0rd commentedit seemed to resolve the issue on my server. Might want more people to give it a go and see if it resolve their issue.
PHP's copy() seems to use fopen() to handle the downloads. fopen() by default handles up to 20 redirects, so it should work on most servers. Using copy() to downloads depends on some PHP settings (allow_url_fopen) though, which may not be enabled on some hosts, which might be why they are having problems.
It's enabled in my server though, and I'm still having issues. I have a feeling it's because of the redirect, as twitter seems to download fine.
Either way, after this change it appears to be resolved on my end. This might be because in system_retrieve_file explicitly sets certain variables regarding download, aka 'max_redirects = 3'
system_retrieve_file() is simply a nice wrapper they added in Drupal 7. In Drupal 6, you'll need to duplicate it and use drupal_http_request() instead =(
Comment #11
j0rd commentedI just upgraded to 7.x-2.1-rc1 and had to re-apply this patch.
Comment #12
Dinesh Kumar Sarangapani commentedComment #13
spazfoxI'm experiencing this problem with the 6.x.2-1 version of the module. My server has allow_url_fopen turned on. Anyone have a comparable fix for Drupal 6 (e.g., using drupal_http_request())?
Comment #14
Vallenwood commentedI can confirm this problem still exists in 7.x-2.2 and has not been fixed. It apparently is not a problem on some servers and is a problem on others; on mine, the full "http://graph.facebook.com/XYZ/picture?type=large" URL definitely does not get read and copied as the JPEG file it points to. The fix suggested by j0rd worked perfectly for me.
Comment #15
nancydruYes, the problem is still there in my new (as of today) installation. It has moved to line 354, but is otherwise the same.
However, I applied the patch and the picture was still not saved.
Comment #16
nancydruThe system_retrieve_file is failing on
https://graph.facebook.com/100000153017678/picture?type=largealthough that address works fine in a browser address bar.Comment #17
nancydruIt is now saving the picture in the user object, but not in the profile (Profile2) field as I have set up.
Comment #18
j0rd commented@NancyDru there are some PHP settings which effect system_retrieve_file() as well. Take a look at post #10. Not sure if that effects you though, but something to look into.
Comment #19
nancydruMy issue is not really the same as the OP, so you can ignore me. We don't use the user picture, we use a profile field (I don't know why). This module simply does not allow for that.
Comment #20
Cristian.Andrei commentedHi,
For the people that have this module working : do I need some special server settings for this module ?
I applied jOrd's patch with no success. I'm using the 7.x-2.2 module version.
I've tried debugging this and what I found was that , when the module calls either "copy($photo_url, $tmp_photo_realpath);" or "system_retrieve_file($photo_url, $tmp_photo_realpath, FALSE, FILE_EXISTS_REPLACE);" , the result is the same : a blank file.
All/any help is greatly appreciated.
Edit : reinstalled the server and the FB images are saved. Apparently the behaviour above was caused by the server state.
Comment #21
ben finklea commentedI'm having this same issue on the 2.5 version of the module.
When you say "reinstalled the server..." what exactly do you mean?
You set up a new Apache server? Reinstalled Drupal? All that? (Sorry, not a sysadmin or dev...)
Comment #22
dafederBump. Trying to map profile photo to a custom image field so far without success. Anyone figured this out?
Comment #23
dafederThe problem is the rpx form_alter function for the user registration is very simple (for instance, assumes a "value" element) and doesn't assume any unusual field types on the form, such as a file field. I added an additional form_alter hook in a project-specific module to bridge the gap; making this standard behavior would require a fair amount of work abstracting those field functions in the rpx module.
So far working alright...
Comment #24
rebekahgolden commentedFor the Apache issue it's possible the server isn't configured to allow file writes to the system temp directory. This shouldn't be an issue in the next version of the module.
Meanwhile dafeder has a great solution for unique mapping needs. For the next version of our module we're looking at better hooks for mapping.
Cheers,
Rebekah