public static function sendPhoto($photo ,$message = ''){
        self::initialize();
        $data = [
            'message' => $message,
            'source' => self::$fb->fileToUpload($photo)
        ];
        try {
            $response = self::$fb->post('/me/photos', $data, self::$page_access_token);
        } catch(Facebook\Exceptions\FacebookResponseException $e) {
            throw new \Exception('Graph returned an error: '.$e->getMessage());
        } catch(Facebook\Exceptions\FacebookSDKException $e) {
            throw new \Exception('Facebook SDK returned an error: '.$e->getMessage());
        }
        $graphNode = $response->getGraphNode();

        return $graphNode['id'];
    }
public static function sendPhoto($photo ,$message = ''){
        self::initialize();
        $data = [
            'message' => $message,
            'source' => self::$fb->fileToUpload($photo)
        ];
        try {
            $response = self::$fb->post('/me/photos', $data, self::$page_access_token);
        } catch(Facebook\Exceptions\FacebookResponseException $e) {
            throw new \Exception('Graph returned an error: '.$e->getMessage());
        } catch(Facebook\Exceptions\FacebookSDKException $e) {
            throw new \Exception('Facebook SDK returned an error: '.$e->getMessage());
        }
        $graphNode = $response->getGraphNode();

        return $graphNode['id'];
    }
public static function sendPhoto ( $ photo , $ message = '' ) { self :: initialize ( ) ; $ data = [ 'message' => $ message , 'source' => self :: $ fb -> fileToUpload ( $ photo ) ] ; try { $ response = self :: $ fb -> post ( '/me/photos' , $ data , self :: $ page_access_token ) ; } catch ( Facebook \ Exceptions \ FacebookResponseException $ e ) { throw new \ Exception ( 'Graph returned an error: ' . $ e -> getMessage ( ) ) ; } catch ( Facebook \ Exceptions \ FacebookSDKException $ e ) { throw new \ Exception ( 'Facebook SDK returned an error: ' . $ e -> getMessage ( ) ) ; } $ graphNode = $ response -> getGraphNode ( ) ; return $ graphNode [ 'id' ] ; }
Send photo and text message

@param $photo
@param string $message
@return bool
@throws \Exception
Send photo and text message