|  | Posted by Rik on 06/07/07 23:19 
On Thu, 07 Jun 2007 19:29:57 +0200, -Lost <maventheextrawords@techie.com>  wrote:
 
 > Rik wrote:
 >> On Thu, 07 Jun 2007 14:21:56 +0200, Prince of Code
 >> <princeofcode@gmail.com> 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.
 
 Problem is: having a server capable of these things.
 
 --
 Rik Wasmus
  Navigation: [Reply to this message] |