0

Is it possible by any way to make a .php with all the data into it a .png

Example:
You got a php that the data displays in the order you want and u
want to like screenshot it and post it into the main .php
like a fucntion createphptoimg("test.php")

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Tekkno
0

Do you mean create an image from a php page that outputs image data, or create an image from a php page that just outputs data?

The first case is easy, just put header('Content-Type: image/png'); at the top. The second one is a bit strange.

0

Am I correct in thinking that you want to make a 'screenshot' of how the derived html would look? Are you trying to create thumbnail image of a page? If so, I don't think it can be done without a hell of a lot of work.

php just spits out data as you've mentioned. It has no idea how the browser is going to render the page as colours, widths etc. It's the browser that does all the work of retrieving images, javascript, styles etc. Without the browser being involved, I can't see how php could create an image. Even with ajax, I can't see how it could be done. Javascript is pretty much blocked from getting screenshots of the client's machine (AFAIK). Could be embarrassing!

There are some sites that offer a service. Can't remember what they're called - thumbshots or something?

As SCP states, you can use gd or imagemagick to create images in a php file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.