Web Page Screenshot

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mareeus@gmail.com

    Web Page Screenshot

    Hi,

    Are there any ways I could get a screenshot of a web-page at a
    specific address in jpeg via php script?

    Regards,
    Marius.

  • Schraalhans Keukenmeester

    #2
    Re: Web Page Screenshot

    mareeus@gmail.c om wrote:
    Hi,
    >
    Are there any ways I could get a screenshot of a web-page at a
    specific address in jpeg via php script?
    >
    Regards,
    Marius.
    >
    Not unless you find an extension that is able to output an image based
    on the requested page internally or write a script that builds an image
    using gd or ImagaMagick features based on the html output.

    Sh.

    Comment

    • mareeus@gmail.com

      #3
      Re: Web Page Screenshot

      On Apr 15, 8:25 am, Schraalhans Keukenmeester <bitbuc...@inva lid.spamwrote:
      >
      Not unless you find an extension that is able to output an image based
      on the requested page internally or write a script that builds an image
      using gd or ImagaMagick features based on the html output.
      >
      Sh.
      Yes this is what I'm hoping to find, but for the moment I haven't
      found such an extension.

      Comment

      • David Quinton

        #4
        Re: Web Page Screenshot

        On 14 Apr 2007 23:44:27 -0700, "mareeus@gmail. com" <mareeus@gmail. com>
        wrote:
        >Yes this is what I'm hoping to find, but for the moment I haven't
        >found such an extension.
        I think that if you use KDE desktop, then Lynx can output image files.
        I'm sure I've done it on on of my Linux boxes here.
        --
        Locate your Mobile phone: <http://www.bizorg.co.u k/news.html>
        Great gifts: <http://www.ThisBritain .com/ASOS_popup.html >

        Comment

        • Toby A Inkster

          #5
          Re: Web Page Screenshot

          mareeus@gmail.c om wrote:
          Are there any ways I could get a screenshot of a web-page at a
          specific address in jpeg via php script?
          If you have a dedicated server, then yes, this is possible. If not, then
          the chances are you don't have the correct permissions set up to do so.

          The basic technique (on a Linux server) would be to constantly run a second
          X server instance as ":1", and have a browser, such as Mozilla or Opera
          running full-screen on that display.

          When you need a screenshot of a site, you just use PHP's system() function
          to run the command which tells your browser to go to the correct web page.
          Then have your PHP script wait for 10 seconds to give the browser time to
          load the page up, then run ImageMagick's "import" command to take a screen
          shot of display :1.

          Be aware though that this can be used by evil crackers as a proxy. Say for
          example, you have a script which takes screen shots of websites like this:



          And say I'm trying to crack into example.net's site through an SQL
          injection vulnerability. To exploit the vulnerability, I'd normally just
          request the following web page:

          http://example.net/search.php?q='; DELETE+FROM+use rs;

          However, if example.net are smart, and have noticed me poking around their
          web server trying to find a vulnerability, so they've blocked my IP
          address. So what do I do?

          http://yoursite.exampl e.com/shot.php?shot=h ttp://example.net/search.php?q='; DELETE+FROM+use rs;

          And now, as far as example.net are concerned, it was *you* who hacked
          their site.

          So if you decide to implement such a feature, beware this security
          problem. There is no "easy fix" for it, but I'd suggest things like:
          respect robots.txt, disallow requests for screenshots of URLs that contain
          a question mark, and log all requests (even log requests which you've
          disallowed).

          --
          Toby A Inkster BSc (Hons) ARCS
          Contact Me ~ http://tobyinkster.co.uk/contact
          Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

          * = I'm getting there!

          Comment

          • Tim Van Wassenhove

            #6
            Re: Web Page Screenshot

            mareeus@gmail.c om schreef:
            Hi,
            >
            Are there any ways I could get a screenshot of a web-page at a
            specific address in jpeg via php script?
            Depends on the OS and webbrowser you want to use for making the
            screenshot... On windows you could use http://iecap.sourceforge.net to
            make 'IE-like' captures...


            --
            Tim Van Wassenhove <url:http://www.timvw.be/>

            Comment

            • Krustov

              #7
              Re: Web Page Screenshot

              <comp.lang.ph p>
              <Schraalhans Keukenmeester>
              <Sun, 15 Apr 2007 07:25:41 +0200>
              <4621b755$0$334 $e4fe514c@news. xs4all.nl>
              write a script that builds an image
              using gd or ImagaMagick features based on the html output
              >
              If the end result is to be shrunk and used as a thumbnail for a links
              page for example - then that would probably be quite acceptable and a
              reasonable way of doing it .

              Comment

              • mareeus@gmail.com

                #8
                Re: Web Page Screenshot

                On Apr 15, 9:13 pm, Krustov <m...@privacy.n etwrote:
                <comp.lang.ph p>
                <Schraalhans Keukenmeester>
                <Sun, 15 Apr 2007 07:25:41 +0200>
                <4621b755$0$334 $e4fe5...@news. xs4all.nl>
                >
                write a script that builds an image
                using gd or ImagaMagick features based on the html output
                >
                If the end result is to be shrunk and used as a thumbnail for a links
                page for example - then that would probably be quite acceptable and a
                reasonable way of doing it .
                Yes, i need this for small thumbnails related to some web pages. I
                prefer a simpler solution and hope to avoid running firefox or ie on a
                server and take screenshots of the screen. I need a small script to
                generate a that small image of a web page to associate it with my link
                in the database. Hope it can be done simpler.

                Comment

                • Krustov

                  #9
                  Re: Web Page Screenshot

                  <comp.lang.ph p>
                  <mareeus@gmail. com>
                  <15 Apr 2007 12:24:30 -0700>
                  <1176665070.058 394.94990@l77g2 000hsb.googlegr oups.com>
                  write a script that builds an image
                  using gd or ImagaMagick features based on the html output
                  If the end result is to be shrunk and used as a thumbnail for a links
                  page for example - then that would probably be quite acceptable and a
                  reasonable way of doing it .
                  >
                  Yes, i need this for small thumbnails related to some web pages. I
                  prefer a simpler solution and hope to avoid running firefox or ie on a
                  server and take screenshots of the screen. I need a small script to
                  generate a that small image of a web page to associate it with my link
                  in the database. Hope it can be done simpler.
                  >
                  How easy or hard depends on how much or how little you know about php .

                  Most of the regulars on here could probably write a basic script to do
                  the job in less than 2 hours as they would no doubt have lots of the
                  code already written and as such would only really need to tinker around
                  with it in order to get it to work .

                  Would write it myself if i didnt have more important things to do and as
                  most seasoned users on here dont write code for other people - i'd say
                  your up shit creek matey .

                  Comment

                  • mareeus@gmail.com

                    #10
                    Re: Web Page Screenshot

                    On Apr 16, 1:19 am, Krustov <m...@privacy.n etwrote:
                    <comp.lang.ph p>
                    <mare...@gmail. com>
                    <15 Apr 2007 12:24:30 -0700>
                    <1176665070.058 394.94...@l77g2 000hsb.googlegr oups.com>
                    >
                    write a script that builds an image
                    using gd or ImagaMagick features based on the html output
                    >
                    If the end result is to be shrunk and used as a thumbnail for a links
                    page for example - then that would probably be quite acceptable and a
                    reasonable way of doing it .
                    >
                    Yes, i need this for small thumbnails related to some web pages. I
                    prefer a simpler solution and hope to avoid running firefox or ie on a
                    server and take screenshots of the screen. I need a small script to
                    generate a that small image of a web page to associate it with my link
                    in the database. Hope it can be done simpler.
                    >
                    How easy or hard depends on how much or how little you know about php .
                    >
                    Most of the regulars on here could probably write a basic script to do
                    the job in less than 2 hours as they would no doubt have lots of the
                    code already written and as such would only really need to tinker around
                    with it in order to get it to work .
                    >
                    Would write it myself if i didnt have more important things to do and as
                    most seasoned users on here dont write code for other people - i'd say
                    your up shit creek matey .
                    I'm not asking for anyone on this forum to write my code. I hope to
                    find someone explain me a little about ImagaMagick or Gd and help me
                    understand better what i have to do. I have never worked with
                    ImagaMagick. Telling me that the code can be written in 2 hours won't
                    help me too much because as you can guess i wouldn't have posted any
                    question here if i could write the script.

                    But the real reason i have posted here is that i thought there might
                    be some code already written for this thing and avoid reinventing the
                    wheel.

                    So if you really want to help with some links to code already written/
                    tutorials ... would be just great.

                    Comment

                    • Krustov

                      #11
                      Re: Web Page Screenshot

                      <comp.lang.ph p>
                      <mareeus@gmail. com>
                      <16 Apr 2007 02:35:06 -0700>
                      <1176716106.857 343.76330@w1g20 00hsg.googlegro ups.com>
                      I'm not asking for anyone on this forum to write my code. I hope to
                      find someone explain me a little about ImagaMagick or Gd and help me
                      understand better what i have to do. I have never worked with
                      ImagaMagick. Telling me that the code can be written in 2 hours won't
                      help me too much because as you can guess i wouldn't have posted any
                      question here if i could write the script.
                      >
                      Look at it as a logical step by step process .

                      (1) create a 800x600 blank image using gd or im

                      (2) grab the html code from the website

                      (3) write script to scan html code for stuff like background colour

                      (4) fill 800x600 with found background colour (or white if none found)

                      (5) write script to check for <imgetc in the html code

                      (6) paste images onto 800x600 image

                      (7) write text onto 800x600 image

                      (8) shrink 800x600 image to thumbnail size

                      Even if you cant actually do it - you will learn loads from trying .

                      Comment

                      • Toby A Inkster

                        #12
                        Re: Web Page Screenshot

                        Krustov wrote:
                        Look at it as a logical step by step process .
                        >
                        (1) create a 800x600 blank image using gd or im
                        (2) grab the html code from the website
                        (3) write script to scan html code for stuff like background colour
                        (4) fill 800x600 with found background colour (or white if none found)
                        (5) write script to check for <imgetc in the html code
                        (6) paste images onto 800x600 image
                        (7) write text onto 800x600 image
                        The mind boggles! Do you really think you can write a full-blown
                        standards-compliant HTML+CSS renderer in 2 hours?! If so, a well-paid
                        job at the Mozilla Foundation is calling for you!

                        The only practical method is to spawn an instance of an existing HTML
                        rendering system (in most cases, this is a full browser -- e.g. Mozilla,
                        Opera) and take a screenshot (using ImageMagick if you wish).

                        --
                        Toby A Inkster BSc (Hons) ARCS
                        Contact Me ~ http://tobyinkster.co.uk/contact
                        Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

                        * = I'm getting there!

                        Comment

                        • Krustov

                          #13
                          Re: Web Page Screenshot

                          <comp.lang.ph p>
                          <Toby A Inkster>
                          <Mon, 16 Apr 2007 12:17:53 +0100>
                          <1k2cf4-4kp.ln1@ophelia .g5n.co.uk>
                          Look at it as a logical step by step process .

                          (1) create a 800x600 blank image using gd or im
                          (2) grab the html code from the website
                          (3) write script to scan html code for stuff like background colour
                          (4) fill 800x600 with found background colour (or white if none found)
                          (5) write script to check for <imgetc in the html code
                          (6) paste images onto 800x600 image
                          (7) write text onto 800x600 image
                          >
                          The mind boggles! Do you really think you can write a full-blown
                          standards-compliant HTML+CSS renderer in 2 hours?! If so, a well-paid
                          job at the Mozilla Foundation is calling for you!
                          >
                          The only practical method is to spawn an instance of an existing HTML
                          rendering system (in most cases, this is a full browser -- e.g. Mozilla,
                          Opera) and take a screenshot (using ImageMagick if you wish).
                          >
                          Take a deep breath and calm down toby .

                          (8) shrink 800x600 image to thumbnail size

                          But then you snipped that part from your reply didnt you :-)

                          Comment

                          • Toby A Inkster

                            #14
                            Re: Web Page Screenshot

                            Krustov wrote:
                            (8) shrink 800x600 image to thumbnail size
                            And what difference do you think that makes? My point is that no-one can
                            write a decent HTML+CSS rendering engine in two months, let alone two
                            hours.

                            --
                            Toby A Inkster BSc (Hons) ARCS
                            Contact Me ~ http://tobyinkster.co.uk/contact
                            Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

                            * = I'm getting there!

                            Comment

                            • Krustov

                              #15
                              Re: Web Page Screenshot

                              <comp.lang.ph p>
                              <Toby A Inkster>
                              <Mon, 16 Apr 2007 15:05:42 +0100>
                              <meccf4-4kp.ln1@ophelia .g5n.co.uk>
                              (8) shrink 800x600 image to thumbnail size
                              >
                              And what difference do you think that makes? My point is that no-one can
                              write a decent HTML+CSS rendering engine in two months, let alone two
                              hours.
                              >
                              In your opinion - what are the problems ? .

                              Comment

                              Working...