|
Posted by IchBin on 08/17/06 19:45
Nico Farr wrote:
> I just can't believe that there is just a pascal solution for Windows
> and a C+ script on the whole net? Does nobody got a way for PHP? Can't
> imagine that I'm the only one with this problem...
>
Not that this helps but here is how you could do it in Java. Not sure if
the PHP Java interface is mature enough to use it for this.
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class ScreenShot
{
public static void main(String[] args)
{
try
{
// Get the screen size
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
Rectangle rectangle = new Rectangle(0, 0, screenSize.width,
screenSize.height);
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(rectangle);
File file;
// Save the screenshot as a png
file = new File("screen.png");
ImageIO.write(image, "png", file);
} catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Navigation:
[Reply to this message]
|