node.js - 如何将Twitter的个人资料图片变大(NodeJs、Ejs和passport)

标签 node.js twitter size passport.js

一些背景信息:我正在使用node.js、express框架、mongo和passport-twitter

我能够成功登录 Twitter 并将 ID、用户名、个人资料图片等信息存储到数据库 (mongo)。我可以使用 ejs 将其传递到我的 View ,但它显示的图像非常小。

我在 Twitter 开发者页面上看到,您可以传递图片的替代尺寸

我的问题是如何使用 Passport.js 语法执行此操作,这是我用于将图像保存到数据库的代码:

 newUser.twitter.profilePic  = profile.photos[0].value;

输出如下:http://pbs.twimg.com/profile_images/568828382079483905/FuEj1pBH_normal.png

我尝试了这段代码:

newUser.twitter.profilePic  = profile._json.profile_image_url.replace('_original','');

但它仍然将图像保存到我的数据库中,如下所示 -> http://pbs.twimg.com/profile_images/568828382079483905/FuEj1pBH_normal.png

所以基本上我要问的是如何使推特图片更大。如何使用 Passport 语法传递正确的大小

预先感谢您的帮助

最佳答案

只需删除_normal,如以下网址:-

http://pbs.twimg.com/profile_images/568828382079483905/FuEj1pBH.png

谢谢

关于node.js - 如何将Twitter的个人资料图片变大(NodeJs、Ejs和passport),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29444521/

相关文章:

php - 使用 Twitter 的 REST API 检索速率限制状态

ios - 如何让以# 或@ 字符串开头的单词像 UIButton 一样?

java - 将 list<data> 传递给自定义适配器

file - Unix 命令行 : How to get the total size of modified files in the last 30 days

node.js - Node js 按时间戳检索最后插入的记录

node.js - 使用 Google Drive API V3 需要的最低 NodeJs 版本是多少?

c++ - vector 大小的段错误

html - 自动调整按钮大小以覆盖每个屏幕的 1/3

node.js - MongoDB-Express::ENOTDIR:不是目录,...gssapi.js/package.json

javascript - TypeScript 类型定义 : how to declare class constructors