本文是小编为大家收集整理的关于用node-webshot捕获网页图像的一些问题的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。
问题描述
我有一个Web应用程序,用带有Express Framework的Node.js编写,而Twitter Boostrap 3在前端,我正在使用此模块 node-webshot 为了保存以png格式的页面状态,当用户从我的网站注销时,随后向用户显示了一个小缩略图,他的最后一个状态是他的最后一个状态页面.
这个模块非常好,但是我正在尝试一些问题,示例:
在本地主机环境(OSX 10.9)上:
当我将应用程序放在数字海洋VPS上时(GNU/Linux-> CentOS 6.5).
您可以看到,是两个不同的问题,第一个问题未能获得字形,第二个问题是.
这是我代码的一部分,可以保存图像,而且工作完美,除了这两个问题.
var options = { quality : 50, }; webshot(refererURL, './public/assets/img/lastScreen.png', options, function(err) { if(err) console.log('Error: some in screenshoot' , err); res.render('select_sys'); });
在模块文档中,这与phantomjs一起使用,有些想法?
预先感谢.
推荐答案
i与Node-webshot遇到了同样的问题.我并没有将模块的phantomjs更新为phantomjs 2.0,而不是完全放弃节点-Webshot.然后我安装了字体,然后安装了whallah. phantomjs 2.0 只需要移至webshot/node_modules/phantomjs/lib,然后/bin目录注意安全.希望这对您有用!
问题描述
I have a web application, written in node.js with express framework, and Twitter Boostrap 3 in front end, and i'm using this module node-webshot in order to save a state of a page in png format, when a users logout from my site, later show to the user a little thumbnail of, his last state of the page.
This module, works really nice, but i'm experimenting some issues, examples:
On localhost environment (OSX 10.9):
When i put my application on my Digital Ocean VPS (GNU/Linux -> CentOS 6.5).
As you can see, are two differents issues, in the first one fail to get the glyphicons and in the second one fail with .... character encoding maybe?.
Here is the portion of my code that save the image, and works perfect, except by this two issues.
var options = { quality : 50, }; webshot(refererURL, './public/assets/img/lastScreen.png', options, function(err) { if(err) console.log('Error: some in screenshoot' , err); res.render('select_sys'); });
In the module docs, says this works with phantomJS, some ideas?
Thanks in advance.
推荐答案
I had the same issue with node-webshot. Rather than giving up on node-webshot entirely, I updated the module's phantomjs to phantomjs 2.0. Then I installed the fonts, and whallah. PhantomJS 2.0 just needs to be moved into webshot/node_modules/phantomjs/lib, and /bin directories to be safe. Hope this works for you!