gpt4 book ai didi

javascript - 通过 captureBase64 截图后 CasperJS 无法正确显示字符

转载 作者:行者123 更新时间:2023-12-03 11:00:37 24 4
gpt4 key购买 nike

我正在使用 captureBase64 截取屏幕截图并将其显示在我的网站中。我有一个在 Windows 和 Linux 上运行的两个测试环境,第一个我使用 Wampserver,另一个 Apache 2.4.6 + php 5.5 都执行相同的 casperjs 代码。

当我使用 Linux 时,我不知道发生了什么,但字符串/字符有时无法正确显示,只是它显示的是我的代码下方的正方形字符:

1. CasperJS

this.click(x(btDetalhes));
this.wait(3000); // Descomentar se der ERROR
casper.waitForResource("Dúvidas", function detalhesPedido(screenShot) {
return screenShot;
}, function onReceived() {
this.log('Wait...');
myScreenShot = this.captureBase64('png', '#ctl00_Conteudo_rptListaCompras_ctl00_pnlPrincipal', {format: 'png', quality: 100});
});

// Logout & Exit
casper.thenOpen(url_logout, function logout() {
// Check if exists screenshot
if (myScreenShot !== "") {
this.echo("data:image/png;base64," + myScreenSHot).exit();
} else {
this.echo('Sorry!')exit('1601');
}
}).run();

我在 CentOS 7 中使用 casperjs-1.1.0-beta3 和 phantomjs-1.9.8。

感谢您的帮助。

最佳答案

我发现答案显然是那么清楚!

我对 casper 脚本进行了 php 回调,脚本完成后将 JSON 返回到 php。

安装 php-gd 后,所有字符串/字符都会正确显示。

谢谢

关于javascript - 通过 captureBase64 截图后 CasperJS 无法正确显示字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28111314/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com