View Full Version : How do they get this screen image ?
01-28-2010, 11:58 AM
I have seen website thumbnails around the web
and now I would like to dynamically create them based on
Here is an example of the HTML that
echo "<img src=\"http://cb-analytics.com/product-thumb.php?id=FARMVILLE\"
width='300px' height='200px' alt='Thumbnail for FARMVILLE' border='2'>";
And here is it running: Test Picture (http://www.expert-world.com/sys/test_picture.php)
How do these people get the screen image ?
What is in the product-thumb.php ?
I have the GD library on my server but I don't know how to
proceed with this one !
Can anyone help me out ?
01-28-2010, 12:43 PM
Thanks for the link, but I can use gd to
resample, resize images etc. so I am not looking
for a thumbnail generator as such,
but to learn the method of building a dynamic website
thumbnail generator like the one shown in my first post.
01-28-2010, 03:12 PM
I think you're talking about grabbing a URL's screenshot?
You need to have your own server to do that.
There is no way to have a script load a website, render it, and take a picture of the screen.
But with your own server, you can do it using some C++ or other software installed within the server.
That's typically what sites like this do:
Browsrcamp uses a Mac operating system (server) to render a website ... showing
what it actually looks like on the Mac Safari browser.
You can also have your own online server ... but at a cost:
It would be cheaper to use an online service (API) to get your screenshots:
01-28-2010, 04:35 PM
There are actually ways to do this with PHP now. You would not be doing this on request, rather going once and capturing the image, maybe doing that every few weeks or months. Look into the imagegrabscreen and imagegrabwindow (windows only). Frankly, this is a lot easier with the imagegrabwindow; the imagegrabscreen would need cropping to fit it in, and I'm betting that most servers will not let you do this. Cropping is honestly the easiest part, what you need to do is execute a command to open a browser, navigate to the site, wait for it to complete, then capture the image.
Check out the imagegrabwindow. On a personal server with windows on it, this is the easiest route. The api actually has an example showing you how to use a COM object for doing an IE screenshot.
01-29-2010, 11:05 AM
Thanks for the input.
I did find a solution and it probably works great
but it only runs on windows servers because as you said
the procedure needs to open a browser.
That solution opens IE.
I do run a server but it is CentOS Linux 5.4
so I can not use that solution :(
I will look into imagegrabwindow anyway.
OK - read it.
Looks great ... untill ...
Note: This function is only available on Windows.
So I guess those websites that are doing this url screen rendering
are probably running a windows server ?
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.