1

How you can realize a minimized view of a html page in a div (like google preview)?

http://img228.imageshack.us/i/minimized.png/

edit: ok.. i see its a picture on google, probably a minimized screenshot.

FamaBln
  • 93
  • 5
  • 1
    I think that mini-version is just an image made by a "screenshot" application โ€“ Bazzz Mar 01 '11 at 10:09
  • If you want to do it yourself, perhaps http://code.google.com/p/browsershots/ will help. Otherwise, try something like http://www.websnapr.com/ โ€“ thirtydot Mar 01 '11 at 10:10

2 Answers2

0

google displays an image thumbnail, so you would need to generate an image using GD or ImageMagic.

The general flow would be

  1. Fetch page content, including stylesheets and all images via curl (potentially tricky to capture all the embedded files but shouldn't be beyond a competent PHP programmer
  2. Construct a rendering of the page inside PHP itself (EXTREMELY tricky! Wouldn't even know where to start with that, though there might be some kind of third party extension available)
  3. Use GD/Imagemagic/whatever to generate a thumbnail image in an appropriate format (shouldn't be too hard).

Clearly, it's the rendering the page from the HTML, CSS, images etc you downloaded that is going to be the difficult part.

Personally I'd be wondering if the effort involved is worth it.

GordonM
  • 31,179
  • 15
  • 87
  • 129
0

This is more or less a duplicate of the question: Create thumbnails from URLs using PHP

However, just to add my 2ยข, my strong preference would be to use an existing web service, e.g. websnapr, as mentioned by thirtydot in the comments on your question. Generating the snapshots yourself will be difficult to scale well, and just the kind of thing I'd think is worth using an established service for.

If you really do want to do this yourself, I've had success using CutyCapt to generate snapshots of webpages - there are various other similar options (i.e. external programs you can call to do the rendering) mentioned in that other question.

Community
  • 1
  • 1
Mark Longair
  • 446,582
  • 72
  • 411
  • 327
  • thx...the CutyCapt link led me to a solution based on qt4 and python. http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/ <--- here is a nice example with python and qt. soory for duplicate โ€“ FamaBln Mar 01 '11 at 10:47