使用node-webshot捕获网页图像时遇到的一些问题 [英] Some issues capturing web page image with, node-webshot

查看:94
本文介绍了使用node-webshot捕获网页图像时遇到的一些问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,它是用node.js和express框架编写的,前端是Twitter Boostrap 3,我正在使用此模块 node-webshot 以便以png格式保存页面状态,当用户从我的网站注销时,稍后向用户显示其最后状态的一些缩略图页面的内容.

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:

在localhost环境(OSX 10.9)上:

On localhost environment (OSX 10.9):

当我将应用程序放在Digital Ocean VPS(GNU/Linux-> CentOS 6.5)上时.

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');
});

在模块文档中,说这适用于phantomJS,有一些想法吗?

In the module docs, says this works with phantomJS, some ideas?

谢谢.

推荐答案

node-webshot我遇到了同样的问题.我没有完全放弃node-webshot,而是将模块的phantomjs更新为phantomjs 2.0.然后我安装了字体,哇. PhantomJS 2.0 只需要移至webshot/node_modules/phantomjs/lib和/bin目录中即可注意安全.希望这对您有用!

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!

这篇关于使用node-webshot捕获网页图像时遇到的一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆