Fix tmp filename and generation for screenshot
This commit is contained in:
parent
c6514a0124
commit
2e003d9dbc
|
@ -169,8 +169,8 @@ $server->addMessageHandler('text', function (ConnectionInterface $from, array $d
|
||||||
});
|
});
|
||||||
|
|
||||||
$server->addMessageHandler('screenshot', function (ConnectionInterface $from, array $data) use ($shell, $messageOutput) {
|
$server->addMessageHandler('screenshot', function (ConnectionInterface $from, array $data) use ($shell, $messageOutput) {
|
||||||
$tmpFilename = sprintf('%s.jpg', tempnam('/tmp', 'remote_i3wm_ws'));
|
$tmpFilename = sprintf('%s/remote_i3wm_ws_screenshot.jpg', sys_get_temp_dir());
|
||||||
$shell->exec('import -window root -quality 10 -display :0 %s', $tmpFilename);
|
$shell->exec('import -window root -quality 10 -display :0 %1$s && chmod 600 %1$s', $tmpFilename);
|
||||||
|
|
||||||
if (file_exists($tmpFilename)) {
|
if (file_exists($tmpFilename)) {
|
||||||
$base64 = base64_encode(file_get_contents($tmpFilename));
|
$base64 = base64_encode(file_get_contents($tmpFilename));
|
||||||
|
|
Loading…
Reference in a new issue