0

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?

  • Take a look at https://stackoverflow.com/a/9949268/1804223 – Lessmore Jan 17 '22 at 20:56
  • Already looked though most of these, nothing I've found has worked yet. Thanks anyways. I also need it to capture the whole desktop, not just a web page. – justdoingmyjob Jan 17 '22 at 21:06
  • And just to be clear, you have only a single display? Also, having never worked with this function, has the server been logged in at least once? Basically, I'm wondering if the login prompt is intentionally blacked out, and you need an active session for desktop screensharing to work. – Chris Haas Jan 17 '22 at 21:13
  • Did you restart the Apache? – Lessmore Jan 17 '22 at 21:26
  • A single display, yes. I am actually working on the server, it's just a local Xampp for now. So I am logged into it right now. I did restart Apache (through Xampp). – justdoingmyjob Jan 17 '22 at 21:58

0 Answers0