You're chasing your tail, but it may be possible to catch it.

I note that http://www.alexa.com/ has thumbnails of web pages.  For
quite a while I've wondered how they do that.  So I researched.

Visit Alexa, find a site with a thumbnail, and download the image.
Check out the JPEG comment -- and see the text, "Thumbnail Framer -
Mozilla".  A search at Google for these words turns up not much at all
(framer.sourceforge.net probably isn't what we're looking for), but it
got me thinking ... the tools (Mozilla and ImageMagick) are already
installed on my workstation, and all I need is glue.

So ... here's how I create a web page thumbnail in FreeBSD.  First
command line option is a URL, the second is an output file.

========================== 8< ==========================
#!/bin/sh
if [ -z "$2" ]; then
  echo "Gimme a filename." ; exit 1
elif ! echo "$1" | egrep -q "https?://"; then
  echo "Gimme a URL." ; exit 1
fi
  # First, get the page title, so we can identify the window...
title="`lynx -source $2 | sed -Ene 's:.*<title>([^<]+)</title>:\1:p'`"
if [ -z "$title" ]; then title="Mozilla"; fi
  # Second, launch mozilla...
mozilla -width 1024 -height 768 "$2" &
  # give it a chance to start...  make longer if your link is slow.
sleep 5
  # Third, capture the window via ImageMagick...
import -resize '20%' -trim -silent -window "$title" "$2"
  # Last, kill off mozilla.
killall mozilla-bin
========================== 8< ==========================

To be safe, I'd run this as its own user.  The Mozilla configuration can
be set up prior to running so that all extra button bars and windows are
disabled or "folded up".  There may be more elegant ways of killing off
the window, but this is good enough for me.  Building a solution that
doesn't require a user to be logged in to an X server is left as an
exercise for the reader....

Of course, none of this has anything to do with PHP.

p

On Wed, Jan 21, 2004 at 11:29:50AM -0600, Alex Hogan wrote:
> 
> Yes..., if that's possible?
> 
> The page in question is for Instructional Developers to select from a series
> of templates to develop lessons from.  These templates have different page
> layouts that have differing types of text/media areas.  The idea is to speed
> up the lesson development process while maintaining the standardization that
> is currently in place.  
> 
> It's those templates that are to be the thumbnails.  I would like to not
> have to create graphics from the different layouts to put on that page if at
> all possible.  If a layout changes or additional ones added then the
> graphics have to change accordingly.
> 
> 
> Am I chasing my tail here?
> 
> 
> alex
> 
> > -----Original Message-----
> > From: Brian V Bonini [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, January 21, 2004 10:59 AM
> > To: Alex Hogan
> > Cc: PHP General list
> > Subject: Re: [PHP] web page thumbs
> > 
> > On Wed, 2004-01-21 at 10:19, Alex Hogan wrote:
> > > Is there a way to create thumbnails of web pages?
> > >
> > >
> > >
> > > I have a page where the user will select a template from a list and I
> > would
> > > like to be able to give them thumbs to associate with the template
> > types.
> > 
> > 
> > Are you saying you want to create this on the fly each time it's needed?
> > 
> > --
> > Brian        GnuPG -> KeyID: 0x04A4F0DC | URL: www.gfx-design.com/keys
> >                                           Key Server: pgp.mit.edu
> > ======================================================================
> > gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
> > GnuPG: http://gnupg.org
> > http://www.biglumber.com/x/web?qs=0x2C35011004A4F0DC
> > Linux Registered User #339825 at http://counter.li.org
> 
> 
> ****************************************************************** 
> The contents of this e-mail and any files transmitted with it are 
> confidential and intended solely for the use of the individual or 
> entity to whom it is addressed.  The views stated herein do not 
> necessarily represent the view of the company.  If you are not the 
> intended recipient of this e-mail you may not copy, forward, 
> disclose, or otherwise use it or any part of it in any form 
> whatsoever.  If you have received this e-mail in error please 
> e-mail the sender. 
> ****************************************************************** 
> 
> 

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/

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

Reply via email to