【发布时间】:2014-09-22 02:05:52
【问题描述】:
我无法使用 phantomjs 正确渲染存储在我的服务器中的一些图像。如果我使用存储在互联网上的任何其他图像工作正常。所以我想知道是否有人可以告诉我一些我应该设置的服务器配置。
我有这个 phantomjs 脚本:
page.open(html, function () {
window.setTimeout(function( status ) {
page.clipRect = { left: 0, top: 0, width: 640, height: 800 };
page.render(outputFolder + htmlBaseName + '.png');
console.log('rendered');
phantom.exit();
}, 2000);
});
还有一个包含表格和这些图像的 html 文件:
<img src="http://myServerURL/image1.png" style="width: 198px; min-height: 181px; max-height: 181px; height: 181px; max-width: 198px;" width="198" height="181">
<img src="http://myServerURL/image2.png" style="width: 198px; min-height: 181px; max-height: 181px; height: 181px; max-width: 198px;" width="198" height="181">
<img src="http://phantomjs.org/img/phantomjs-logo.png" style="width: 198px; min-height: 181px; max-height: 181px; height: 181px; max-width: 198px;" width="198" height="181">
我得到了回报:
我的图片可以从互联网上查看
【问题讨论】:
-
请注册
onResourceError、onResourceTimeout和onError活动。可能有错误。