I am using 7.2.27 PHP version with Laravel 7.
Below code working on my local same configuration,
$captured = imagegrabscreen();
imagepng($captured, "~path/" . time() . ".png");
imagedestroy($captured);
But this code not working on live server it's throwing exception like, Fatal error: Uncaught Error: Call to undefined function imagegrabscreen() in ~file-path:11 Stack trace: #0 {main} thrown in ~file-path on line 11
I don't know what is the exact issue.
I also checked below answer but I don't know what is php_gd2.dll
,
https://stackoverflow.com/a/8715544/6656706
Edit:
I also tried on AWS ec2 with xampp but not working ! I also tried by installing php_gd2.dll
.
Any help will be appreciated !
Thanks.
If the server is on Linux, it can't work because imagegrabscreen() is only supported on Windows:
Note:
This function is only available on Windows.
Also note that the screenshot is performed on the server. It will not capture the user screen.