Skip to content
This repository has been archived by the owner on Sep 5, 2018. It is now read-only.

Facebook profile picture issue #12

Open
skrosoft opened this issue Feb 6, 2014 · 8 comments
Open

Facebook profile picture issue #12

skrosoft opened this issue Feb 6, 2014 · 8 comments

Comments

@skrosoft
Copy link
Contributor

skrosoft commented Feb 6, 2014

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
Copy link
Member

emodric commented Feb 6, 2014

Hi Vincent,

this works for me without any problems.

curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );

is already used in ngConnectFunctions::fetchDataFromUrl

@skrosoft
Copy link
Contributor Author

skrosoft commented Feb 6, 2014

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
Copy link
Contributor Author

skrosoft commented Feb 6, 2014

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

What do you think?

@emodric
Copy link
Member

emodric commented Feb 6, 2014

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
Copy link
Contributor Author

skrosoft commented Feb 6, 2014

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
Copy link
Member

emodric commented Feb 10, 2014

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.

@emodric emodric added invalid and removed invalid labels Feb 12, 2014
@skrosoft
Copy link
Contributor Author

skrosoft commented Mar 3, 2014

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

@emodric
Copy link
Member

emodric commented Mar 4, 2014

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants