For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2006 > Create thumbnail from webpage









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Create thumbnail from webpage
Mike Blezien

2006-01-29, 6:56 pm

Hello,

I need to create a thumbnail image of a webpage to be displayed in the browser.
is there a perl module available that has this capability or can this be done
with ImageMagick or GD? Been looking for about a day on this subject but not
much luck.

Basically we capture a remote webpage, then need to take that data and create a
thumbnail(snapshot) of it.

TIA,
--
Mike(mickalo)Blezien

Chas Owens

2006-01-29, 6:56 pm

On 1/29/06, Mike Blezien <mickalo@frontiernet.net> wrote:
> Hello,
>
> I need to create a thumbnail image of a webpage to be displayed in the br=

owser.
> is there a perl module available that has this capability or can this be =

done
> with ImageMagick or GD? Been looking for about a day on this subject but =

not
> much luck.
>
> Basically we capture a remote webpage, then need to take that data and cr=

eate a
> thumbnail(snapshot) of it.
>
> TIA,
> --
> Mike(mickalo)Blezien

snip

When you say "we capture a remote webpage" do you mean that you are
capturing an image of it or just downloading the HTML? If the former
then GD or ImageMagick will easily be able to resize it to a
thumbnail; however, if you mean the later then you will first need to
render the HTML. I don't know of any modules that do that (but you
might search CPAN), but you should be able to feed the HTML into
Firefox and do a screen capture. At that point you can just resize
the image.
Randal L. Schwartz

2006-01-29, 6:56 pm

>>>>> "Mike" == Mike Blezien <mickalo@frontiernet.net> writes:

Mike> I need to create a thumbnail image of a webpage to be displayed in the
Mike> browser. is there a perl module available that has this capability or
Mike> can this be done with ImageMagick or GD? Been looking for about a day on
Mike> this subject but not much luck.

A webpage as rendered by *which* browser? And with what settings?

The point of the web is that there's no "one look" for a page... you describe
generalities, and each browser renders it appropriate for the environment in
which it appears.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Mike Blezien

2006-01-29, 6:56 pm

Chas,

Chas Owens wrote:
> On 1/29/06, Mike Blezien <mickalo@frontiernet.net> wrote:
>
>
> snip
>
> When you say "we capture a remote webpage" do you mean that you are
> capturing an image of it or just downloading the HTML? If the former
> then GD or ImageMagick will easily be able to resize it to a
> thumbnail; however, if you mean the later then you will first need to
> render the HTML. I don't know of any modules that do that (but you
> might search CPAN), but you should be able to feed the HTML into
> Firefox and do a screen capture. At that point you can just resize
> the image.


I appologize for being a bit vague here, but I am trying to clarify this with a
client for myself. the way it was stated too me:

"..we should also be able to pick up the front page of the web site and create a
thumb-nail image of it .."

now I am assuming they mean the entire page content and create a thumbnail of
it. I've search CPAN for the last couple of hours on this, but no luck. maybe it
can be done on the fly. I was hoping to get a lead on this to see if it's even
possible too do. :)

Thx's

--
Mike(mickalo)Blezien

Randal L. Schwartz

2006-01-29, 6:56 pm

>>>>> "Mike" == Mike Blezien <mickalo@frontiernet.net> writes:

Mike> "..we should also be able to pick up the front page of the web site and create
Mike> a thumb-nail image of it .."

That's probably from a PHB, or a web designer, who doesn't seem to
understand that there's no *one* rendering of the "front page".

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Mike Blezien

2006-01-29, 6:56 pm

Thanks, I think you head that one on head :)



Randal L. Schwartz wrote:
>
> Mike> "..we should also be able to pick up the front page of the web site and create
> Mike> a thumb-nail image of it .."
>
> That's probably from a PHB, or a web designer, who doesn't seem to
> understand that there's no *one* rendering of the "front page".
>



--
Mike(mickalo)Blezien

JupiterHost.Net

2006-01-29, 6:56 pm

> I appologize for being a bit vague here, but I am trying to clarify this
> with a client for myself. the way it was stated too me:
>
> "..we should also be able to pick up the front page of the web site and
> create a thumb-nail image of it .."
>
> now I am assuming they mean the entire page content and create a
> thumbnail of it. I've search CPAN for the last couple of hours on this,
> but no luck. maybe it can be done on the fly. I was hoping to get a lead
> on this to see if it's even possible too do. :)


unless a browser on the server has a "take a screen shot of url" feature
API you can (and most likely will) have to:

a) open a browser on your server with a system call
b) use your OS to take a snapshot of that "screen" to a file
c) have your way with the file

The *only* way i've been able to do this was (all code is at my office
but there are scripts that do it on the net)

open3() a pipe to an XWindows server window
open3() a pipe to a GUI browser in the window created in that step
open3() the XWindows screen shot
close all 3
work with file if needed

The parameter you will pass will need fiddled with so that you grab only
the part of the browser that is displaying the web page.

Google it and you'll find a few scripts that use various browsers for
XFree86.

HTH :)
Mike Blezien

2006-01-29, 6:56 pm

Thanks for the info.

what exactly would be the best pharse to Google for this??

JupiterHost.Net wrote:
>
>
> unless a browser on the server has a "take a screen shot of url" feature
> API you can (and most likely will) have to:
>
> a) open a browser on your server with a system call
> b) use your OS to take a snapshot of that "screen" to a file
> c) have your way with the file
>
> The *only* way i've been able to do this was (all code is at my office
> but there are scripts that do it on the net)
>
> open3() a pipe to an XWindows server window
> open3() a pipe to a GUI browser in the window created in that step
> open3() the XWindows screen shot
> close all 3
> work with file if needed
>
> The parameter you will pass will need fiddled with so that you grab only
> the part of the browser that is displaying the web page.
>
> Google it and you'll find a few scripts that use various browsers for
> XFree86.
>
> HTH :)
>



--
Mike(mickalo)Blezien

Chas Owens

2006-01-29, 6:56 pm

On 1/29/06, JupiterHost.Net <mlists@jupiterhost.net> wrote:
> unless a browser on the server has a "take a screen shot of url" feature
> API you can (and most likely will) have to:


Happily Firefox starting with version 1.5 has just such a feature (it
uses the infrastructure of the new canvas tag).
Brano Gerzo

2006-01-29, 6:56 pm

Mike Blezien [MB], on Sunday, January 29, 2006 at 16:17 (-0600) wrote
the following:

MB> what exactly would be the best pharse to Google for this??

webthumb


--

...m8s, cu l8r, Brano.

[Serology: Study of English Knighthood]


Mike Blezien

2006-01-30, 6:56 pm

Has any one successfully installed "Webthumb" on a Linux/RH 7.3 ? Been trying to
get this too work, but it keeps hanging after displaying:

bash: pnmscale: command not found
bash: pnmtojpeg: command not found

then it just hangs here? It create a empty jpg file, but just stalls out.

we installed what was required as listed here http://www.boutell.com/webthumb

this is a perl utility that is suppose to capture a webpage and generate a
thumbnail image. If any one has any info on getting this too work, it would be
much appreciated if you can help out.

TIA,

Brano Gerzo wrote:
> Mike Blezien [MB], on Sunday, January 29, 2006 at 16:17 (-0600) wrote
> the following:
>
> MB> what exactly would be the best pharse to Google for this??
>
> webthumb
>
>



--
Mike(mickalo)Blezien

Ing. Branislav Gerzo

2006-01-30, 6:56 pm

Mike Blezien [MB], on Monday, January 30, 2006 at 07:44 (-0600) made
these points:

MB> bash: pnmscale: command not found
MB> bash: pnmtojpeg: command not found

I never tried this utility, but know about that, if you get some
thumbnails from it, let us know. For those commands not found, it easy
task, just install them: Quote from webpage:

The netpbm image manipulation utilities. Almost always installed; it's
easy to build them yourself or install them as a package.

Also use google for pnmscale and pnmtojpeg, it is your friend, really.

--

How do you protect mail on web? I use http://www.2pu.net

[Flash! Bill Clinton nominates Lorena Bobbit for Surgeon G]


Mike Blezien

2006-01-30, 6:56 pm



Ing. Branislav Gerzo wrote:
> Mike Blezien [MB], on Monday, January 30, 2006 at 07:44 (-0600) made
> these points:
>
> MB> bash: pnmscale: command not found
> MB> bash: pnmtojpeg: command not found
>
> I never tried this utility, but know about that, if you get some
> thumbnails from it, let us know. For those commands not found, it easy
> task, just install them: Quote from webpage:
>
> The netpbm image manipulation utilities. Almost always installed; it's
> easy to build them yourself or install them as a package.
>
> Also use google for pnmscale and pnmtojpeg, it is your friend, really.
>


I have the two files aboved installed but get this error when running the
wethumb script from the command line:

pnmscale: EOF / read error reading magic number
pnmtojpeg: EOF / read error reading magic number

what exactly does this mean.

Thx's

--
Mike(mickalo)Blezien

Ing. Branislav Gerzo

2006-01-30, 6:56 pm

Mike Blezien [MB], on Monday, January 30, 2006 at 08:30 (-0600) typed
the following:

MB> I have the two files aboved installed but get this error when running the
MB> wethumb script from the command line:

MB> pnmscale: EOF / read error reading magic number
MB> pnmtojpeg: EOF / read error reading magic number

this should be magic number issue, you have magic command installed?

http://unixhelp.ed.ac.uk/CGI/man-cgi?magic

As I said, I never run this script, because I use FreeBSD and it is a
bit different.

--

How do you protect mail on web? I use http://www.2pu.net

[Plain dealing is more often praised than practiced.]


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com