c815902 Posted August 13, 2009 Share Posted August 13, 2009 Hi All, How can I convert html to image. I want to create image from html file/string and on both the domains. How can I achieve that in php? I would appreciate your help. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/ Share on other sites More sharing options...
JonnoTheDev Posted August 13, 2009 Share Posted August 13, 2009 That makes no sense. Please elaborate. Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897312 Share on other sites More sharing options...
Mark Baker Posted August 13, 2009 Share Posted August 13, 2009 My suspicion would be that he wants to "thumbnail" web pages Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897331 Share on other sites More sharing options...
c815902 Posted August 13, 2009 Author Share Posted August 13, 2009 Yes, I want to "thumbnail" web pages. And these html-code been input from textarea field. p.s. I am not 100% fluent in English, but at least I am improving. Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897481 Share on other sites More sharing options...
JonnoTheDev Posted August 13, 2009 Share Posted August 13, 2009 This cannot be achieved using server side php. To screen grab HTML output would require a broswer interface and a screen print function. php could be used to collect the data required i.e websire urls however another technology would be required to screen capture the websites and save as images. Mozilla Firefox has an add on to achieve this https://addons.mozilla.org/en-US/firefox/addon/1146 Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897537 Share on other sites More sharing options...
c815902 Posted August 14, 2009 Author Share Posted August 14, 2009 I may not describe very clearly , pls allow me to explain more details ... User input html code in textarea at front page. After the form is submitted, my PHP script will create a image such as : I really want is below image : Thanks for your kindly help. Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897848 Share on other sites More sharing options...
roopurt18 Posted August 14, 2009 Share Posted August 14, 2009 You can probably do this with the GD (or graphics) extension. It will likely not be an easy task though. Font calculations can be a pain in the ass to deal with. Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897866 Share on other sites More sharing options...
Psycho Posted August 14, 2009 Share Posted August 14, 2009 There are also 3rd party utilities that will convert HTML code into an image representatin of the web page - they don't take a screen grap of the page, they dynamically create an image based upon the code. I don't know if there are any free ones. Here's one that you could use on a web server and utilize through PHP: http://www.converthtmltoimage.com/ (assuming you are not on a shared host) And another: http://www.guangmingsoft.net/htmlsnapshot/help.htm Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897880 Share on other sites More sharing options...
JonnoTheDev Posted August 14, 2009 Share Posted August 14, 2009 After the form is submitted, my PHP script will create a image such as Ah, I see This shouldnt be too difficult then. You could either use php's native graphics functions or my choice would be to use Imagemagick (may need to install on your server) http://www.imagemagick.org/script/index.php If you use the GD libraries in PHP then go through this tutorial http://www.thesitewizard.com/php/create-image.shtml Quote Link to comment https://forums.phpfreaks.com/topic/170099-how-can-i-convert-html-filestring-to-image/#findComment-897958 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.