PHP Browser screenshot???

Discussion in 'PHP' started by evenfall, Apr 28, 2007.

  1. #1
    I figured this would be an easy task, but googling it hasn't turned up anything...so I'm hoping that you guys can help.

    So I have a browser based game (using html and javascript). Basically, the player can drag and drop some words and make their own message.

    Once the user has created their message, I would like them to be able to press a button which takes a screenshot of their message. The idea is to create a gallery of all messages that have been created.

    I'd prefer to use PHP, since most scripting on the site will be done in PHP (Javascript would be cool, too), but I'm open to any suggestions. I found a couple of threads here that make it sound damn near impossible. Is Flash maybe a better solution? If not Flash, then what?
     
    evenfall, Apr 28, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    PHP is on the server side and cannot take screen shots of the user's screen. Neither JavaScript can. You will have to think of another way to achieve this.
     
    nico_swd, Apr 28, 2007 IP
  3. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #3
    Screenshots are client-side. You might be able to do this with Flash or Java, not sure how though
     
    frankcow, Apr 28, 2007 IP
  4. evenfall

    evenfall Well-Known Member

    Messages:
    145
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Ok, that makes sense...now I feel like an idiot for asking :eek:. I just have no clue as to how to approach this.
     
    evenfall, Apr 28, 2007 IP
  5. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #5
    No need to feel like an idiot! Forums are for asking questions - sometimes it's the quickest way to learn!

    You may want to post a project on rentacoder or something
     
    frankcow, Apr 28, 2007 IP
  6. Jim_

    Jim_ Peon

    Messages:
    72
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Tell your clients to hit the 'PrintScreen' button on their keyboards and paste the image into MSPaint. :p

    If you're wanting to save a screen capture, the best way to do it would be create a JAVA applet to take the screenshot and submit it to your site. The Robot class can be used to take the screencapture and the ImageIO class can save the buffer as a jpeg image.

    I don't know how your script works, but it may be possible to have it generate a list of all the words and their locations, which can be sent to a PHP script which parses this data and generates an image based on the words and their positions with the GD library.
     
    Jim_, Apr 28, 2007 IP
  7. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #7

    You could create images using the GD library. Let's say there are X words they can drag & drop... After they click on that button you could send positions of all those words to the PHP script and then create an image using that info...
     
    SoKickIt, Apr 28, 2007 IP
  8. evenfall

    evenfall Well-Known Member

    Messages:
    145
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #8
    Thanks for the replies...some interesting ideas to try out here.

    I was hoping for more of a quick fix. When I have some free time and I'm in a programming mood I'll see if I can come up with something (I'll post about it here if I manage to get it working).

    For now I think I'll just tell the users to take a screenshot and send it in if they really want to.

    User friendliness is overrated :)
     
    evenfall, Apr 29, 2007 IP
  9. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280