获取更大的Facebook个人资料图片问题PHP SDK

时间:2018-10-03 05:58:47

标签: php facebook api sdk

成功注册后,我通过这种方式获取用户的Facebook图片

    /*
     * Get user profile picture
     */
    try {
        // Returns a `FacebookFacebookResponse` object
        $response = $fb->get(
            '/' .$fbUserProfile['id'] . '/picture',
            $_SESSION['facebook_access_token']
        );
    } catch(FacebookExceptionsFacebookResponseException $e) {
        echo 'Graph returned an error: ' . $e->getMessage();
        exit;
    } catch(FacebookExceptionsFacebookSDKException $e) {
        echo 'Facebook SDK returned an error: ' . $e->getMessage();
        exit;
    }

    $avatar = $response->getHeaders()['Location'];
    $this->model_account_customer->addCustomerAvatar($avatar, $this->customer->getId());

到目前为止,效果很好,但是图片大小为50x50 :(。我在这里阅读了所有类似的问题,但是没有一个对我有帮助。此外,我尝试添加type=large,我已经更改了像这样的$response数组

            $response = $fb->get(
            '/' .$fbUserProfile['id'] . '/picture',
            $_SESSION['facebook_access_token'],
            array(
                'type' => 'large'
            )
        );

仍然无法正常工作。任何想法将不胜感激:)

0 个答案:

没有答案