2 years ago

#62466

test-img

justdoingmyjob

imagegrabscreen function in php only gets a black screen, how do I fix this?

Here is the code I'm using:

<?php

    $im = imagegrabscreen();
    imagepng($im, "C:/pathtofile/image.png");
    imagedestroy($im);

The images get saved but when I open them, they are just black. I'm using Apache for my server, I already enabled "Allow services to interact with desktop" in services. I have also tried using jpg instead of png. Everything just results in a black image. I have also tried with this header: header('Content-type: image/png'); but that doesn't make any difference. Anyone have any suggestions?

php

apache

png

jpeg

screenshot

0 Answers

Your Answer

Accepted video resources