- Create a new php file using any IDE of your choice
( Netbeans,Dreamweaver etc)
- Write the following code inside the file.
- Save in htdocs folder under XAMP.
- Run the file by entering Localhost in the browser.
- After successful run you can find a new image file in the root directory.
$temp=imagegrabscreen();
imagepng($temp,"myimage");
imagedestroy($temp);
Where $temp
is a temporary variable which you can rename as your wish. myimage
is the name of the image file which will get created while running the code. This name also you can give any name which you like.