I may have found something, a perl script that with all the appropriate
pieces turns a page into a jpg image.

http://marginalhacks.com/Hacks/html2jpg/

from there resizing using GD is a snap.

Warren Vail

-----Original Message-----
From: Vail, Warren [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:48 PM
To: 'Jason Davidson'; Michael Mao; [EMAIL PROTECTED]
Subject: RE: [PHP] thumbnail of webpage

I have been looking into this over the last week and have come up blank as
well.  Doing this manually is simple, point your browser to your URL, and in
windows use <alt><print Scrn> to copy an image of the rendering in the
browser to the scratch-pad, then paste the image into a tool like paint to
cut out the part of the image you want, and use the skew/stretch tool in
paint to create the thumbnail (GD is a good solution as well) saving the
file as a jpg image.

The difficulties with php is that opening the URL with fopen or using CURL
allows getting the content of a page in html form, but provides no bitmap
rendering of all that, let alone allowing JavaScript to alter the
presentation as it would in a browser.

What would be useful, if there were a way to open the URL in an IFRAME, and
with JavaScript somehow capture a bitmap of the rendering of the web page,
perhaps encoding the bitmap as mod64 characters and placing the result in a
textarea for posting as input to a php script.  This was the best solution
that I could come up with but I don't have the skills to make this happen,
yet.  Question for anyone here, is does this sound like a path that might
work?  Can JavaScript access the rendered content of a webpage in window
bitmap form?

In my travels, someone had suggested coding something using mozilla and
invoking it from a php script, but no one has done this yet that I can
determine.

Warren Vail


-----Original Message-----
From: Jason Davidson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:08 PM
To: Michael Mao; [EMAIL PROTECTED]
Subject: Re: [PHP] thumbnail of webpage


First, im not sure how you would capture a snapshot of the page, sinse the
page is rendered by the browser, and php is completely server side.
Possibly there is a way to fopen a page or something, but... i dunno..

as for making thumbnail, using the gd extension, is quite easy. check the
manual for GD.

Jason


"Michael Mao" <[EMAIL PROTECTED]> wrote:
>
> Is there a way to capture a snapshot of a html page and save it as a
> jpg
> using php?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to