Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3336 > unrolled thread

web page to image

Started bybob <bob@coolgroups.com>
First post2011-10-08 17:39 -0700
Last post2011-10-17 19:40 -0500
Articles 12 — 10 participants

Back to article view | Back to comp.lang.php


Contents

  web page to image bob <bob@coolgroups.com> - 2011-10-08 17:39 -0700
    Re: web page to image The Natural Philosopher <tnp@invalid.invalid> - 2011-10-09 02:35 +0100
      Re: web page to image paris2venice <paris2venice@gmail.com> - 2011-10-08 23:55 -0700
        Re: web page to image The Natural Philosopher <tnp@invalid.invalid> - 2011-10-09 09:11 +0100
          Re: web page to image houghi <houghi@houghi.org.invalid> - 2011-10-09 11:18 +0200
    Re: web page to image Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-08 22:15 -0400
    Re: web page to image Michael Vilain <vilain@NOspamcop.net> - 2011-10-08 22:18 -0700
    Re: web page to image bobm3@worthless.info - 2011-10-09 15:39 -0400
      Re: web page to image The Natural Philosopher <tnp@invalid.invalid> - 2011-10-09 20:43 +0100
        Re: web page to image Arno Welzel <usenet@arnowelzel.de> - 2011-10-10 09:19 +0200
    Re: web page to image "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-10-10 11:12 +0200
    Re: web page to image gordonb.cydcw@burditt.org (Gordon Burditt) - 2011-10-17 19:40 -0500

#3336 — web page to image

Frombob <bob@coolgroups.com>
Date2011-10-08 17:39 -0700
Subjectweb page to image
Message-ID<74de1a18-820b-4985-899d-737b2fb8b655@u6g2000vbo.googlegroups.com>
I want to turn a web page into a 768x1024 image using PHP.  For
instance the script might load http://www.example.com/ and output a
768x1024 image.  Anyone know how to do this?

[toc] | [next] | [standalone]


#3337

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2011-10-09 02:35 +0100
Message-ID<j6qto9$cig$1@news.albasani.net>
In reply to#3336
bob wrote:
> I want to turn a web page into a 768x1024 image using PHP.  For
> instance the script might load http://www.example.com/ and output a
> 768x1024 image.  Anyone know how to do this?
> 
Forget it: you need a browser to do that.

[toc] | [prev] | [next] | [standalone]


#3341

Fromparis2venice <paris2venice@gmail.com>
Date2011-10-08 23:55 -0700
Message-ID<30d81937-a584-4aba-9568-67caa3e2464d@v18g2000pri.googlegroups.com>
In reply to#3337
On Oct 8, 6:35 pm, The Natural Philosopher <t...@invalid.invalid>
wrote:
> bob wrote:
> > I want to turn a web page into a 768x1024 image using PHP.  For
> > instance the script might loadhttp://www.example.com/and output a
> > 768x1024 image.  Anyone know how to do this?
>
> Forget it: you need a browser to do that.

It could be done if you can execute external Unix commands with PHP
which I believe you can.  I'm just not advanced enough at PHP to show
how Unix commands can be executed to accomplish this.

[toc] | [prev] | [next] | [standalone]


#3342

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2011-10-09 09:11 +0100
Message-ID<j6rl0d$ipk$1@news.albasani.net>
In reply to#3341
paris2venice wrote:
> On Oct 8, 6:35 pm, The Natural Philosopher <t...@invalid.invalid>
> wrote:
>> bob wrote:
>>> I want to turn a web page into a 768x1024 image using PHP.  For
>>> instance the script might loadhttp://www.example.com/and output a
>>> 768x1024 image.  Anyone know how to do this?
>> Forget it: you need a browser to do that.
> 
> It could be done if you can execute external Unix commands with PHP
> which I believe you can.  I'm just not advanced enough at PHP to show
> how Unix commands can be executed to accomplish this.

system() is the way, or the exec() type calls. BUT essenially you want 
to exec a full screen browser and take a screen shot.


OR bite the bullet and start hacking e.g. Mozilla source.

[toc] | [prev] | [next] | [standalone]


#3343

Fromhoughi <houghi@houghi.org.invalid>
Date2011-10-09 11:18 +0200
Message-ID<slrnj92pn5.3j0.houghi@penne.houghi>
In reply to#3342
The Natural Philosopher wrote:
> paris2venice wrote:
>> On Oct 8, 6:35 pm, The Natural Philosopher <t...@invalid.invalid>
>> wrote:
>>> bob wrote:
>>>> I want to turn a web page into a 768x1024 image using PHP.  For
>>>> instance the script might loadhttp://www.example.com/and output a
>>>> 768x1024 image.  Anyone know how to do this?
>>> Forget it: you need a browser to do that.
>> 
>> It could be done if you can execute external Unix commands with PHP
>> which I believe you can.  I'm just not advanced enough at PHP to show
>> how Unix commands can be executed to accomplish this.
>
> system() is the way, or the exec() type calls. BUT essenially you want 
> to exec a full screen browser and take a screen shot.
>
>
> OR bite the bullet and start hacking e.g. Mozilla source.

Or perhaps use something like http://browsershots.org/
It all depends on wether you want to do occisional screenshots or want
to download all of the internet.

With the above URL I am sure that you should be able to script it. Not
sure if it is an option or not.


houghi
-- 
________________________  	Open your eyes, open your mind
			| 	proud like a god don't pretend to be blind
			|	trapped in yourself, break out instead
http://openSUSE.org	|	beat the machine that works in your head

[toc] | [prev] | [next] | [standalone]


#3338

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-10-08 22:15 -0400
Message-ID<j6r043$dev$1@dont-email.me>
In reply to#3336
On 10/8/2011 8:39 PM, bob wrote:
> I want to turn a web page into a 768x1024 image using PHP.  For
> instance the script might load http://www.example.com/ and output a
> 768x1024 image.  Anyone know how to do this?
>

First you need something to render the page, similar to a browser.  PHP 
can't do that (at least not without a few man-decades of work).  Then 
you need to capture that page, which again, PHP can't do.

Once you've gotten this far, you could use the gd functions to create an 
image.

The real question here is - what problem are you trying to solve?

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#3339

FromMichael Vilain <vilain@NOspamcop.net>
Date2011-10-08 22:18 -0700
Message-ID<vilain-0BD849.22183208102011@news.individual.net>
In reply to#3336
In article 
<74de1a18-820b-4985-899d-737b2fb8b655@u6g2000vbo.googlegroups.com>,
 bob <bob@coolgroups.com> wrote:

> I want to turn a web page into a 768x1024 image using PHP.  For
> instance the script might load http://www.example.com/ and output a
> 768x1024 image.  Anyone know how to do this?

You'd have to 'build an image' of the site using the internal equivalent 
of a web browser.  And they all render HTML slightly differently.  Not 
an easy task to do in PHP.

Or you could just tell Safari to PRINT TO PDF and save the web site as a 
PDF file.  That's what I do.  Better than an image because I can click 
on the links and be taken to the sites referenced.

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]

[toc] | [prev] | [next] | [standalone]


#3349

Frombobm3@worthless.info
Date2011-10-09 15:39 -0400
Message-ID<60u397hp19d95qdsfcshc8tus0broop2sb@4ax.com>
In reply to#3336
On Sat, 8 Oct 2011 17:39:53 -0700 (PDT), bob <bob@coolgroups.com>
wrote:

>I want to turn a web page into a 768x1024 image using PHP.  For
>instance the script might load http://www.example.com/ and output a
>768x1024 image.  Anyone know how to do this?

I do this at work regularly for training/demonstration purposes.  I
use a gnome screen capture program which allows me to capture the
entire desktop, current window or even a marked area and save the
capture in any image format I desired.  Then these captured images can
be printed, emailed, included, even put in a presentation.  Captured
imaged looks as good as the real thing.

[toc] | [prev] | [next] | [standalone]


#3350

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2011-10-09 20:43 +0100
Message-ID<j6stgc$pla$2@news.albasani.net>
In reply to#3349
bobm3@worthless.info wrote:
> On Sat, 8 Oct 2011 17:39:53 -0700 (PDT), bob <bob@coolgroups.com>
> wrote:
> 
>> I want to turn a web page into a 768x1024 image using PHP.  For
>> instance the script might load http://www.example.com/ and output a
>> 768x1024 image.  Anyone know how to do this?
> 
> I do this at work regularly for training/demonstration purposes.  I
> use a gnome screen capture program which allows me to capture the
> entire desktop, current window or even a marked area and save the
> capture in any image format I desired.  Then these captured images can
> be printed, emailed, included, even put in a presentation.  Captured
> imaged looks as good as the real thing.

yeah but that's a manual process innit?

not under software control...

[toc] | [prev] | [next] | [standalone]


#3357

FromArno Welzel <usenet@arnowelzel.de>
Date2011-10-10 09:19 +0200
Message-ID<4E929C95.60303@arnowelzel.de>
In reply to#3350
The Natural Philosopher, 2011-10-09 21:43:

> bobm3@worthless.info wrote:
>> On Sat, 8 Oct 2011 17:39:53 -0700 (PDT), bob <bob@coolgroups.com>
>> wrote:
>>
>>> I want to turn a web page into a 768x1024 image using PHP.  For
>>> instance the script might load http://www.example.com/ and output a
>>> 768x1024 image.  Anyone know how to do this?
>>
>> I do this at work regularly for training/demonstration purposes.  I
>> use a gnome screen capture program which allows me to capture the
>> entire desktop, current window or even a marked area and save the
>> capture in any image format I desired.  Then these captured images can
>> be printed, emailed, included, even put in a presentation.  Captured
>> imaged looks as good as the real thing.
> 
> yeah but that's a manual process innit?
> 
> not under software control...

gnome-screenshot can also be used as a command line tool with parameters
to do screenshots without user interaction.

See
<http://linux.dsplabs.com.au/gnome-screenshot-screen-capture-under-linux-p22/>
for examples.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#3359

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2011-10-10 11:12 +0200
Message-ID<j6uctm$df3$1@dont-email.me>
In reply to#3336
El 09/10/2011 2:39, bob escribió/wrote:
> I want to turn a web page into a 768x1024 image using PHP.  For
> instance the script might load http://www.example.com/ and output a
> 768x1024 image.  Anyone know how to do this?

I don't think you'll find a pure PHP rendering engine but, if installing 
new software is an option, you can try wkhtmltopdf to convert to PDF and 
then ImageMagick to convert the first page to picture:

http://code.google.com/p/wkhtmltopdf/
http://www.imagemagick.org/script/index.php


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#3451

Fromgordonb.cydcw@burditt.org (Gordon Burditt)
Date2011-10-17 19:40 -0500
Message-ID<tMWdnYqcgLOKVgHTnZ2dnUVZ_u2dnZ2d@posted.internetamerica>
In reply to#3336
> I want to turn a web page into a 768x1024 image using PHP.  For

Is there a reason for this, besides, of course, Copyright Infringement?

> instance the script might load http://www.example.com/ and output a
> 768x1024 image.  Anyone know how to do this?

You need something that will render HTML.  There are some packages
that are essentially intended to *PRINT* HTML, but can be used to
get the page rendered into some other format.

One way to do it (manually) is to use the Firefox "print to file"
to print to a .pdf file, then use pdftoppm and one other program
from the NetPBM package to convert it to your favorite form of image
(.png (use pnmtopng), .jpeg (use pnmtojpeg), or whatever).  Or you
could save to PostScript and use GhostScript to convert it to your
favorite image format.

Another way to do it (manually or from a script) is to use html2ps
to render the page in Postscript, then use GhostScript to convert
it to your favorite format (GhostScript has a variety of "devices"
which amount to outputting an image of various types into a file).
This can be invoked from PHP running a series of shell commands or
a shell script.  Be careful of where you create temporary files or
you'll run into permission problems, as PHP usually runs under an
id without many privileges.  Also don't use fixed temporary file
names as several users may be requesting this at the same time,
and they'll clobber each other.

You may need to come up with a way of specifying a "paper size"
that matches what you want in an image, as the first step thinks
it's formatting stuff for a printer.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web