SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: grab screenshot

  1. #1
    SitePoint Addict
    Join Date
    Aug 2009
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    grab screenshot

    Hi, is there a way an image can be captured of a webpage and then have an option to save it?

    I have a form that when its completed I want a button to download an image or something similar to that.

    Any suggestions would be cool. Cheers,

    Paul

  2. #2
    SitePoint Wizard silver trophy Crazybanana's Avatar
    Join Date
    Mar 2003
    Location
    In tha fruit cellar
    Posts
    1,379
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    this is the only screencapture i have seen using php (only works on windows)
    PHP Code:
    <?php
    $browser 
    = new COM("InternetExplorer.Application");
    $handle $browser->HWND;
    $browser->Visible true
    $browser->Navigate("http://www.google.com");
    /* Still working? */
    while ($browser->Busy) {
    com_message_pump(4000);
    }
    $im imagegrabwindow($handle0);
    $browser->Quit();
    imagepng($im"iesnap.png");
    imagedestroy($im);
    ?>
    to grab a fullscreen pic you can add
    PHP Code:
    $browser->FullScreen true
    Who's to doom when the judge himself is dragged before the bar


  3. #3
    SitePoint Addict
    Join Date
    Aug 2009
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would this be saved? Would there be a button? Sorry, just not that clued up to be honest

  4. #4
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is also a way to use Firefox from command line, direct output to Xvfb, convert Xvfb to jpeg image and save it.

    This method will work on Linux. I've done this before and can say it worked for me. I don't have a sample code right now, sorry.


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
  •