0

私は wkhtmltoimage を使用してページのスクリーンショットを撮りますが、私の問題は、スクリーンショットをロードするページが、リッスンする必要があるトリミングに関する詳細を含むアラートを送信することです。wkhtmltoimageでアラートをリッスンし、使用する詳細を取得する方法を知っている人はいますか?

Cutycapt で似たようなことをしました。これが私のコマンドです

 $cutyResult = shell_exec('export DISPLAY=:99 && /usr/local/bin/wkhtmltoimage --width ' .$data['screenshots']['screenwidth']. ' --heigh ' .$data['screenshots']['screenheight']. ' ' . $url . ' /data/output.png && --expect-alert "screenshot" 2>&1 | grep crop')
 $cutyResult = trim($cutyResult);
 preg_match("/\[alert\] \"cropx=([0-9]+)&cropy=([0-9]+)&cropwidth=([0-9]+)&cropheight=([0-9]+)\"/", $cutyResult, $matches);
 print_r($matches);

しかし、これはアラートを待っているようには見えませんか? 何か案は?

4

1 に答える 1

1

アラートは、Web サーバーからのログから最適に取得できます。

たとえば、次のようにします。

tail -f  /var/log/apache2/error.log

wkhtmltoimage: cannot connect to X server
or any error messages generated from the program. 

エラー メッセージを解析し、探しているエラーをtailfパイプします。grep

于 2015-03-05T18:36:01.413 に答える