src/Twitter/Connections/UserConnection.php
private function base64EncodeMedia($mediaPath)
    {
        //get media type (extension)
        $type = pathinfo($mediaPath, PATHINFO_EXTENSION);

        //get media data
        $data = file_get_contents($mediaPath);

        //encode the filedata with base64 - and then concatenate to make the encoded string.
        $encodedData = 'data:image/' . $type . ';base64,' . base64_encode($data);

        //return the encoded data
        return $encodedData;
    }
private function base64EncodeMedia($mediaPath)
    {
        //get media type (extension)
        $type = pathinfo($mediaPath, PATHINFO_EXTENSION);

        //get media data
        $data = file_get_contents($mediaPath);

        //encode the filedata with base64 - and then concatenate to make the encoded string.
        $encodedData = 'data:image/' . $type . ';base64,' . base64_encode($data);

        //return the encoded data
        return $encodedData;
    }
Base64 encode the Media located at $mediaPath.

@param  string $mediaPath media where it's located
@return string