Thumbnail creation

I want to give url of a page as parameter and create a screenshot or thumbnail of that page which should be displayed in search result for the pages. Can anyone guide me how to do this?

PHP doesn’t have HTML render engine. It is server software, not client.
So, nothing to do with PHP programming. Use some third-party service or application

If you search this section of the forum there have been a few posts about this.
I tried the code out below from one of the replys that works but you will need to create the thumbnail part. From memory it will only work on a windows setup? But you will have to test it yourself:

<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.google.com");
/* Still working? */
while ($browser->Busy) {com_message_pump(4000);
}$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");
imagedestroy($im);
?>  

Where will this code save the thumbnail images ? How can I store them in database and retrieve later so that it will be fast to render in page? Is there possibility to use ajax though I don’t have any idea about it ?:S

That code will save the thumbnail as iesnap.png into the current directory.

Displaying images on the web page is quite different question.
Though I can say that storing images in the database will slow page render, not make it fast.