Re: Creating Thumbnail image of a webpage ?



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.

This is pretty much what browsershots.org does.

The biggest difficulty that springs to my mind is this is probably not something that can be done on a shared hosting plan or whatnot. Heck, maybe not even on a dedicated server unless you are the one who runs it.

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



Relevant Pages

  • Re: Image size question
    ... >> I have an app that has many subdirectories containing one or more ... >> The thumbnail idea also presents the same problem. ... tells the browser not the expect a webpage but rather an image. ... But does it appear somewhere in the current webpage or open up a new ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Creating Thumbnail image of a webpage ?
    ... for is "Create a small image (Thumbnail) of a webpage. ... PHP is not a browser, so it has no clue how to handle HTML/CSS/etc., so it would have to be told this. ... Rik Wasmus ...
    (comp.lang.php)
  • Re: how does one edit php.ini to allow multiple url parameter separators?
    ... It seems there is some confusion between arg_separator.output and ... PHP, so that those webpage that use those URL's are valid. ... In the location bar of your browser. ...
    (comp.lang.php)
  • Creating Thumbnail image of a webpage ?
    ... How do i create a image of webpage in php? ... for is "Create a small image (Thumbnail) of a webpage. ...
    (comp.lang.php)
  • Re: how to run scripts after a page has already loaded and been sent to a users browser?
    ... > It's because PHP is a server side scripting language, ... > do stuff before you send stuff to user's web browser. ... As we've discussed on this newsgroup before, if a script starts ... that is after the last HTML is sent to a web browser. ...
    (alt.php)

Loading