...

View Full Version : can imagegrabscreen() actually capture pages with content loaded?



helraizer
11-22-2007, 07:04 PM
Hi folks and folksesses,

In the GD2 library there is a function called 'imagegrabscreen()' and 'imagegrabwindow()', which captures a screen dump of the current window, or another one specified by the code.

The only problem is that it launches the function as soon as the page is loaded, which means the target page, which is being grabbed hasn't actually loaded at the time of the screen grab. So all you are left with is an image of a blank page. Which renders it slightly pointless.

Is there any way you can get the code to sleep until the screen/window (to be grabbed) has loaded, so it actually contains the content?

Thanks,

Sam

angst
11-22-2007, 08:28 PM
hmm, interesting problem.

have you tried: usleep() ?
that *might* work.

http://www.php.net/usleep

mlseim
11-22-2007, 09:22 PM
I just noticed this note in the manual:
"Note: This function is only available on Windows."

I'm guessing that means a Windows server (not UNIX)?

I haven't tried the imagegrabscreen myself either.

angst
11-22-2007, 09:29 PM
ah, i didn't even notice that message.

helraizer
11-23-2007, 12:49 AM
I just noticed this note in the manual:
"Note: This function is only available on Windows."

I'm guessing that means a Windows server (not UNIX)?

I haven't tried the imagegrabscreen myself either.


Hmm.. yeah, good point! Just tested it.. it works on my Apache xaamp.. :) but not on my web host.. :( Ah well, it was a good idea. :p

Thanks guys,
Sam

mlseim
11-23-2007, 02:08 AM
darn it ...

The first post sort of excited me because I hadn't seen that before.

My webhosts are UNIX ... rats!

psykx
11-23-2007, 09:30 AM
sleep() works on *nix though as it's an inbuilt function and all there are some possibly useful comments on the man page

Ahri
11-23-2007, 03:41 PM
Why on earth would you want to grab a screenshot from your "UNIX" (most likely Linux, but anyway) host?

1) You're not running any graphical apps on the server (are you?!)
2) The server probably doesn't even have the pointless overhead of a windowing system

CFMaBiSmAd
11-23-2007, 05:46 PM
psykx and Ahri - did either of you read this thread, starting with the title and the first post or investigate what 'imagegrabscreen()' and 'imagegrabwindow()' were in the php manual?

psykx - the issue does not have anything to do with the sleep() function being present on *nix based systems :eek:

Those of us that looked up the imagegrabwindow() function in the php manual, noticed that it uses COM to invoke an instance of an application (such as a web browser and open a web page in it) and allows you to capture a screen shot of the results.

Ahri
11-23-2007, 06:29 PM
psykx and Ahri - did either of you read this thread, starting with the title and the first post or investigate what 'imagegrabscreen()' and 'imagegrabwindow()' were in the php manual?

psykx - the issue does not have anything to do with the sleep() function being present on *nix based systems :eek:

Those of us that looked up the imagegrabwindow() function in the php manual, noticed that it uses COM to invoke an instance of an application (such as a web browser and open a web page in it) and allows you to capture a screen shot of the results.
Sorry, I forgot to make it clear that I was addressing mlseim.

mlseim
11-24-2007, 02:43 AM
Ahri ...

I think UNIX in this case means what my webhost is running to
serve my webpages. The screenshot is actually a screenshot of
the webpage that is getting served to the user.

My website/PHP/GD needs to be on a Windows server.

.... at least that's what I assume the notation means in the GD manual.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum