Jump to content

take image of webpage


dcole.ath.cx
 Share

Recommended Posts

No, I think the closest thing to this would be like javascripts window print function.Why would you need this anyways? Im sure you could use the gd library with variables and such to acheive what you want.

Link to comment
Share on other sites

  • 4 weeks later...

That's true, but you can't tell PHP to press ctrl-alt-prtscn, or any other key combination for that matter. Not to mention that paint isn't installed on a Linux server, or that the specific keystrokes are for Windows only.He was asking how to use PHP to generate an image of a rendered web page (to dynamically create thumbnails of pages for a search engine). The answer, before the posts got deleted, was that a rendering engine needs to be used to render the page and save it, and I'm sure there are several programs available to do that, but not necessarily for free. But you can always use Firefox's Gecko engine and write your own program to save the rendering as an image I guess.

Link to comment
Share on other sites

It was for my search engine... Justsome guy, what where you talking about before where a php function could find from start to a point, then from that point to another until it reaches the end of a string. For finding words in () or before and after ORs and ANDs..

Link to comment
Share on other sites

Could you use the split function to put it into an array? And what you probably want to do is use the gd library, which is a library that allows you to create custom images by putting strings of text and colors onto it.So what you could probably do is this, look up all the dodad on the gd library and hw to create images, then make it so you can put php in a .gif or some extension like that.. then I beleive there is a highlight page function or something that can pull the source code of a page so you might be able to just put html on the image and it will automatically look like that page. so for the thumbnail you would put this:<img src="render.gif?site=http://w3schools.com" />, I think you know what to do for the rest now :)

Link to comment
Share on other sites

That wouldn't work so automatically like that. You can write whatever text you want to an image, if you want to use source code or whatever to put in the image you can do that (the highlight function, BTW, highlights PHP source, not HTML), but the image will show the code itself. At that point it is an image of code. Which might be handy if you don't want people to be able to directly copy and paste, they would have to write it themselves.But you can't render the HTML. The browser, not PHP, renders the HTML, and the browser is not involved in creating the image, only PHP is. Different browsers do different things with HTML because each of them use their own rendering engine (except for Netscrape, which uses the Gecko engine from Mozilla). So you can't create a page render from HTML source without using a rendering engine, and PHP does not have any use for one.

Link to comment
Share on other sites

You can use highlight_file or highlight_string:http://www.php.net/manual/en/function.highlight-file.phphttp://www.php.net/manual/en/function.highlight-string.phpFor example, highlight_file(__FILE__) will highlight the current file, which is good for making self-describing examples:http://manchine.net/w3/array.php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...