dilbertone Posted February 27, 2012 Share Posted February 27, 2012 Hi, I was curious if there is anyway to create website screenshots on the fly via a php script. Thanks, dilbertone - the first dilbert on earth Quote Link to comment https://forums.phpfreaks.com/topic/257865-thumbnail-web-screenshots-script-with-php/ Share on other sites More sharing options...
batwimp Posted February 27, 2012 Share Posted February 27, 2012 http://us3.php.net/manual/en/function.imagegrabscreen.php Quote Link to comment https://forums.phpfreaks.com/topic/257865-thumbnail-web-screenshots-script-with-php/#findComment-1321675 Share on other sites More sharing options...
dilbertone Posted February 27, 2012 Author Share Posted February 27, 2012 imagegrabscreen — Captures the whole screen - a PHP-script that scrapes 500 different sites and stores the results as thumbnails This example demonstrates how to take a screenshot of the current screen and save it as a png image. imagegrabscreen as a base for a webscraper that runs with PHP and collects images i thought we c note - all i need are previews or thumbnails i do not need fully fledged images. <?php $im = imagegrabscreen(); imagepng($im, "myscreenshot.png"); imagedestroy($im); ?> This example demonstrates how to take a screenshot of the current screen and save it as a png image. well - to spell it out. i need approx 500 to 1000 webshots ( images that are stored as thumbnails with 240 pixels at the long distance at maximum. what do you guess. i think it should be pretty obvious but I'll mention it anyway, if we re running GPU-intensive applications (not CPU), calling this function will cause quite some significant lag to our machine and server response until the request is complete. For this to work our Apache service must be set to 'Allow service to interact with desktop' otherwise we will just get a blank image. Question: how to implement the long list of 500 URLS that i have to visit and create a thumbnails? Quote Link to comment https://forums.phpfreaks.com/topic/257865-thumbnail-web-screenshots-script-with-php/#findComment-1321745 Share on other sites More sharing options...
batwimp Posted February 27, 2012 Share Posted February 27, 2012 OK. I get what you're saying. I did a little research. See if this page can help you: http://stackoverflow.com/questions/757675/website-screenshots-using-php Quote Link to comment https://forums.phpfreaks.com/topic/257865-thumbnail-web-screenshots-script-with-php/#findComment-1321748 Share on other sites More sharing options...
ManiacDan Posted February 27, 2012 Share Posted February 27, 2012 imagegrabscreen only works on windows and it grabs the current screenshot that you see on your monitor. It does not load websites and render them. You will have to find a third party solution for this, PHP cannot do it by itself. You can attempt to: 1) Figure out how to pass URLs to firefox, then use imagegrabscreen to take screenshots of your entire desktop, which you will have to trim later. 2) See if you can exploit the rendering engine and plugins of firefox or chrome, the firefox plugin ScreenGrab might be useful to you. Quote Link to comment https://forums.phpfreaks.com/topic/257865-thumbnail-web-screenshots-script-with-php/#findComment-1321772 Share on other sites More sharing options...
QuickOldCar Posted February 28, 2012 Share Posted February 28, 2012 I wrote some helpful information and links about this in the forum. http://www.phpfreaks.com/forums/index.php?topic=352033.msg1662293#msg1662293 Quote Link to comment https://forums.phpfreaks.com/topic/257865-thumbnail-web-screenshots-script-with-php/#findComment-1321931 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.