5

I've got an idea for a site that would generate png or jpeg screenshots of webpages on the fly. The end user would never see the pages, but the HTML would be turned into a screenshot instead and the end user would see that screenshot.

How can I get started on this? I guess what I'm looking for is some kind of PHP function that takes the HTML as an argument and then produces an image file in a specified location.

4
  • 3
    Sounds like you are trying to duplicate functionality that is mastered by others: browsershots.org (site testing) and thumbshots.com (site thumbs) Commented Jan 28, 2010 at 14:05
  • I think you're looking for a "website thumbnail generator." Do a Google search for "PHP thumbnail generator" and see what comes up. What you want is sufficiently complex: it's essentially a browser that outputs to an image file instead of to a screen. Commented Jan 28, 2010 at 14:07
  • See similar questions stackoverflow.com/search?q=screenshots+with+php Commented Jan 28, 2010 at 14:08
  • Thanks guys - it looks like this is going to be more complicated that I first thought. I guess I was just looking for a create_image(path/to/image/image.png, webpage.html) function, but no such luck. I'll have to give it more time later. For the record, I'm looking to dynamically create screenshots of pages as they are generated by a CMS, so the browsershots.org and thumbshots.org sites aren't really up to it. Thanks, though. Commented Feb 1, 2010 at 23:30

2 Answers 2

1

As far as I know, PHP does not do this.

You can, however, find a solution using external tools. Here is how I would do it

  1. Generate the HTML
  2. I would pass this HTML to a external tool using exec. There is, for instance this one.
  3. Then, display the generated picture
Sign up to request clarification or add additional context in comments.

Comments

1

http://www.zubrag.com/articles/create-website-snapshot-thumbnail.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.