0

I'm using the following code:

<?php
$im = imagegrabscreen();
imagepng($im, "myscreenshot.png");
imagedestroy($im);
?>

And I as a result I get this:

Fatal error: Call to undefined function: imagegrabscreen() in c:\usr\krasnal\www\testy marcina\index.php on line 2

I am using apatch ver 2.7 instaled on windows 7. And one more info about GD:

GD Version: bundled (2.0.28 compatible)

FreeType Support: yes

FreeType Linkage: with freetype

T1Lib Support: no

GIF Read Support: yes

GIF Create Support: yes JPG Support: yes

PNG Support: yes

WBMP Support: yes

XBM Support: yes

JIS-mapped Japanese Font Support: no

What's wrong?

Marcin Kostrzewa
  • 565
  • 4
  • 11
  • 24

2 Answers2

2

Also:

For this to work your Apache service must be set to 'Allow service to interact with desktop' otherwise you will just get a blank image. To fix this right-click My Computer, select Manage/Services and Applications/Services - find the apache service (like Apache2) and right-click, select Properties - choose the Log on tab and check the 'Allow service to interact with desktop' checkbox. Restart Apache.

zaf
  • 22,776
  • 12
  • 65
  • 95
1

You need at least php 5.2.2 or later, and php_gd2.dll

Here is a code snippet to test on your server : https://stackoverflow.com/a/4526834/1093649

And if you get a blank screen, please check Apache service privileges like stated on this php manual page comment.

Community
  • 1
  • 1
Justin T.
  • 3,643
  • 1
  • 22
  • 43