poleposters Posted April 20, 2008 Share Posted April 20, 2008 This might sound like an odd question. I want my users to be able to create a restaurant menu to include on their profile pages. I want to make things easy for them and create the menu online, since I doubt many of them would be able to create an image themselves even using paint(sounds silly, but most people have no idea!) So I am investigating whether it is possible to "print" a HTML page(complete with syle) to a JPEG using PHP. The reason I need a jpg is becaue I am using a flash/php pageflip book. If anyone can tell me if this is possible, and if so , point me in the right direction, that would be great! And if anyone has any alternative methods to achieve this, I would appreciate any suggestions. Cheers! Link to comment https://forums.phpfreaks.com/topic/102035-can-i-turn-html-into-a-jpeg-with-php/ Share on other sites More sharing options...
GingerRobot Posted April 20, 2008 Share Posted April 20, 2008 Well, you can create images on the fly with the GD library: www.php.net/gd To make them look like an HTML page would either take a lot of effort to parse the HTML page and determine what it's supposed to like, or it might be possible to use this function: imagegrabwindow() The above function is only supported with a PHP version of 5.2.2 or higher, and a window machine. It should be possible to save the HTML the user generates, then use that function to take a screenshot of it. Finally, you could use the gd library functions to create an image. Link to comment https://forums.phpfreaks.com/topic/102035-can-i-turn-html-into-a-jpeg-with-php/#findComment-522181 Share on other sites More sharing options...
dptr1988 Posted April 20, 2008 Share Posted April 20, 2008 This is pretty hard to do. Basicly you need a web browser or other HTML rendering program installed on the server and have the PHP script run that rendering program, and return the result. As for doing it all in PHP, it's pretty much impossible, unless you were to write a complete HTML renderer in PHP. ( Way too hard!!! ) Link to comment https://forums.phpfreaks.com/topic/102035-can-i-turn-html-into-a-jpeg-with-php/#findComment-522182 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.