SitePoint Sponsor

User Tag List

Page 1 of 5 12345 LastLast
Results 1 to 25 of 122

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Oct 2002
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Web Page screen shot!!!

    Ok, this might be expecting the impossible but i'll ask anyway!!!

    Is there anyway that php can grab a screenshot of a web page and save it as a jpg/gif.

    A client wants some links for their site and if possible I would likea small thumbnail of the linksite displayed on my clients site.

    I doubt this is possible though...

    Happy New Year.

    Eternity

  2. #2
    SitePoint Evangelist compwizard's Avatar
    Join Date
    May 2002
    Location
    United States
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I really don't know if it is possible in PHP, but couldn't you have a cron job/scheduled event run an image capture program on the server and save a screenshot? Sorry I couldn't be more specific.
    Compwizard
    "There are 10 kinds of people in this world -- those who know binary, and those who don't."

  3. #3
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This isnt possible. Screenshots are entirely dependant on the operating system/browser. So to get a screenshot with PHP you would need to write a graphical user-agent (browser) in PHP.
    THE INSTRUCTIONS BELOW ARE OLD AND MAY BE INACCURATE.
    THIS INSTALL METHOD IS NOT RECOMMENDED, IT MAY RUN
    OVER YOUR DOG. <-- MediaWiki installation guide

  4. #4
    webality...dunno what it means bcp_2005's Avatar
    Join Date
    Jun 2002
    Location
    Huntsville Alabama
    Posts
    394
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Phil.Roberts
    This isnt possible. Screenshots are entirely dependant on the operating system/browser. So to get a screenshot with PHP you would need to write a graphical user-agent (browser) in PHP.
    Is that possible?

  5. #5
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    -sigh- No it isnt.
    THE INSTRUCTIONS BELOW ARE OLD AND MAY BE INACCURATE.
    THIS INSTALL METHOD IS NOT RECOMMENDED, IT MAY RUN
    OVER YOUR DOG. <-- MediaWiki installation guide

  6. #6
    webality...dunno what it means bcp_2005's Avatar
    Join Date
    Jun 2002
    Location
    Huntsville Alabama
    Posts
    394
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Phil.Roberts
    -sigh- No it isnt.
    Didn't think so.

  7. #7
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would say it is possible, but a lot of trouble and would require triggering other applications.

    For example, if you were using OSX you could have PHP trigger an AppleScript which could load a given page and take a screenshot and you could convert that file...
    I'm sure something like that could be done with Windows or Linux as well.

    Quite possibly not worth doing, but worth examining if you are interested.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  8. #8
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why php?
    Why not a stand-alone app (VB, C#) that reads urls from a list and then grabs the page and takes the screenshot?
    (And then upload the images to the server...)









    And, yes, I know you can write stand-alone apps in php too, but I don't know how to re-use the web browser component of IE from that language...

  9. #9
    Non-Member Siltrince's Avatar
    Join Date
    Aug 2001
    Location
    Belgium
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Web Page screen shot!!!

    Originally posted by kjc
    ...

    A client wants some links for their site and if possible I would likea small thumbnail of the linksite displayed ...
    Unless you need 50+ screenshots I would say take them yourself.

  10. #10
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is, however, interesting to find out how to do it.
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.

  11. #11
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The second post is accurate..

    Write a shell script that will take a screen shot of a page, and store it somewhere, I know that can be done, I forget what site it was, but a guy had a perl shell script that did it for him.. if only I could remember
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  12. #12
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See. It is possible after all.
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.

  13. #13
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried to do this a few weeks back, but I don't have the knowledge to do it on my own

    I have Apache and PHP set up on a Windows box. I made a batch file to open IE and load a URL.

    I had two problems though:
    1) While I could get PHP to execute the batch file, I couldn't figure out how to get PHP to send a URL to the batch file (the only way I could get it to work was to hard code a URL in the batch file)
    2) I couldn't figure out how to get the batch file to simulate a keystroke (such as F11) so that the screen capture program in the background would activate and take a screenshot.

    Peter

  14. #14
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your usin exec or another php command to open IE, you can tell it a url to open like so:

    iexplorer.exe "http://site.com"

    via command line ( assuming iexplorer.exe is in the CWD )
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  15. #15
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any idea how to simulate a keystroke?

  16. #16
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not just make a program to do this? Using VB.net perhaps?
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.

  17. #17
    Non-Member Siltrince's Avatar
    Join Date
    Aug 2001
    Location
    Belgium
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by friend_al_23
    See. It is possible after all.
    Everything is possible , you just have to see if it's worth all te trouble

  18. #18
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Siltrince
    Everything is possible , you just have to see if it's worth all te trouble
    Everything is worthwhile. Even little things.
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.

  19. #19
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reason I don't just make a program for it is because I don't know much about programming. Just a little of perl, php, and javascript.

  20. #20
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by peternm22
    The reason I don't just make a program for it is because I don't know much about programming. Just a little of perl, php, and javascript.
    You know javascript, then maybe you'll be a hang of the .NET framework. I'm not sure.
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.

  21. #21
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hrm, i'll do some research on simulating key strokes

    There has to be a command that you can run via shell to take a screen shot...
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  22. #22
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah... I just found a way to run the screen capture program via command line. Here's what the batch file looks like so far:

    Code:
    start iexplore.exe http://www.hotmail.com
    start C:\HQScreen.exe 0 PNG 8 picture C:\
    The problem is, I need the program to pause for a couple seconds before executing the second line (in order to give the webpage time to load).

    Any ideas?

  23. #23
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hrm...

    No clue on that again, im sure there is some type of pause( [int] seconds ); command, but im not a shell scripter, so no clue ;P
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  24. #24
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So close, yet so far away

  25. #25
    PHP Programmer QReyes's Avatar
    Join Date
    Oct 2001
    Location
    Philippines
    Posts
    698
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not trigger a count or something after the page pops-up?
    The Star Circle Quest Community - Community website for SCQ fans.
    Telebisyon.net - Reference guide to TV series shown in the Philippines.
    Lyrics Server Online! - All the lyrics you can get on one website.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •