Re: Creating Thumbnail image of a webpage ?



Rik wrote:
On Thu, 07 Jun 2007 19:29:57 +0200, -Lost <maventheextrawords@xxxxxxxxxx> wrote:

Rik wrote:
On Thu, 07 Jun 2007 14:21:56 +0200, Prince of Code <princeofcode@xxxxxxxxx> wrote:

How do i create a image of webpage in php? Basically what I am looking
for is "Create a small image (Thumbnail) of a webpage.

Let me know about your thought.

Your Help is greatly appreciated !
With PHP?
Very, very tricky. PHP is not a browser, so it has no clue how to handle HTML/CSS/etc., so it would have to be told this.
You could use some code of HTML2PS packages and take it from there.
Depending on how often you need this, just making a screenshot by hand is often a far more costeffective solution.

Hrmm... I do not think it would be too tricky.

Using CURL, or fopen, or whatever other method suits you to retrieve the contents.

Parse script tags and style declarations (making sure to look for @imports, et cetera).

Then you could fire open a quick instance of whatever browser or COM instance you desire, fire a snapshot utility, save that and resample with PHP's image functions, GD or ImageMagick.

Well, if you have control over a server enabling you to take snapshots this way, it could be done for sure. PHP is hardly the language to do it with though. And you wouldn;t need to parse style-declarations etc... You'd just open a browser on the server and take your snapshot.

Good point.

Problem is: having a server capable of these things.

Exactly! Unless there is some simple exec commands to issue to a Linux box, I wouldn't even begin to know where to start on that one.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am kidding. No I am not.
.