netgen / ngconnect

Netgen Connect is a simple eZ Publish extension able to provide user sign in by using social network authentication and authorization.
http://projects.ez.no/ngconnect
GNU General Public License v2.0
8 stars 7 forks source link

Facebook profile picture issue #12

Open skrosoft opened 10 years ago

skrosoft commented 10 years ago

Hi,

Facebook large profile picture doesnt work.

The CURL to graph.facebook.com/XXX/picture?type=large save the file to ngconnect/facebook_XXX but WITHOUT extension.

EzPublish doent accept to use this following code with a filename without extension:

$dataMap['image']->fromString( $fileName );
$dataMap['image']->store();

I solved that by using these following lines of code before the CURL request:

$pathInfo = pathinfo($authResult['picture']);
if (!isset($pathInfo['extension'])) $fileName .= '.jpg';

Any opinion? Is this fix is OK, the '.jpg' string could be implemented in the ngconnect.ini file for each Login Method.

Atte,

emodric commented 10 years ago

Hi Vincent,

this works for me without any problems.

curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );

is already used in ngConnectFunctions::fetchDataFromUrl

skrosoft commented 10 years ago

It doesnt work for me

This line doesnt help because there is no problem getting the image file without the extension

curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );

The problem is that the destination filename is generated without extension, and my ezpublish doesnt accept a file without extention

$fileName = $storageDir . '/' . $authResult['login_method'] . '_' . $authResult['id'];

Maybe I just need a PHP Extension in my server's configuration? php_fileinfo ?

Thank you.

Atte,

skrosoft commented 10 years ago

php_fileinfo enabled, the problem is still here, maybe its because I'm using 5.3.X?

What do you think?

emodric commented 10 years ago

I honestly don't know what the problem could be.

My profile picture from Facebook correctly redirects to JPEG version.

https://graph.facebook.com/edi.modric/picture?type=large redirects to https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/t5/276026_627700479_2028134500_n.jpg

eZ Publish correctly fetches it and stores. Try updating your profile picture on Facebook, to see if that fixes the problem.

skrosoft commented 10 years ago

Edi,

The problem is not getting the image, the problem is the filename without file extension generated by:

$fileName = $storageDir . '/' . $authResult['login_method'] . '_' . $authResult['id'];

This filename is generated before the curl request, so there is no issue with the cURL request.

Apparently, this is not an ngconnect issue but an issue with the fromString function that does not allow source filename without extension.

I will investigate and if I have more information, I will share it to you.

Thank you for your time.

emodric commented 10 years ago

I know, what I wanted to say is that Facebook obviously provides URLs without extensions, so I'm not really sure I can do anything in Netgen Connect in that case.

skrosoft commented 10 years ago

You could add an entrie in the INI file and update the PHP code ;)

emodric commented 10 years ago

I'm sorry Vincent,

add an entry with what? What can we do (except guessing) if Facebook doesn't provide the extension of the picture?