farzher Posted January 18, 2012 Share Posted January 18, 2012 I have the content of an email in a database, and I need to generate a screenshot of the email based on that.. I'm thinking this won't be possible in PHP and I'll have to use some service? Anyone know where to begin? Link to comment https://forums.phpfreaks.com/topic/255289-generate-a-screenshot-of-html-css-code/ Share on other sites More sharing options...
scootstah Posted January 18, 2012 Share Posted January 18, 2012 You could use the GD library to create an image with the text from the email. Link to comment https://forums.phpfreaks.com/topic/255289-generate-a-screenshot-of-html-css-code/#findComment-1308928 Share on other sites More sharing options...
farzher Posted January 18, 2012 Author Share Posted January 18, 2012 That's interesting, but the content is HTML / CSS, and I need to somehow have it rendered before I take a screenshot of it, which I think would require a browser? Link to comment https://forums.phpfreaks.com/topic/255289-generate-a-screenshot-of-html-css-code/#findComment-1308929 Share on other sites More sharing options...
floridaflatlander Posted January 18, 2012 Share Posted January 18, 2012 I'm not sure I know what your doing but can you use print screen then paste it in an image editor and trim as needed? Link to comment https://forums.phpfreaks.com/topic/255289-generate-a-screenshot-of-html-css-code/#findComment-1308930 Share on other sites More sharing options...
farzher Posted January 18, 2012 Author Share Posted January 18, 2012 I'm reading the email content from a pop3 connection, it's all automated. Nice try though x) Link to comment https://forums.phpfreaks.com/topic/255289-generate-a-screenshot-of-html-css-code/#findComment-1308935 Share on other sites More sharing options...
farzher Posted January 20, 2012 Author Share Posted January 20, 2012 Hey guys, I found what I need, it's called wkhtmltoimage It's a binary file that you can execute using PHP. I have it installed on my server in the root folder, just above public_html, and I can execute it through SSH, but I can't figure out how to execute it from my php script. Which is in public_html/lib/functions.php I tried this: exec("wkhtmltoimage-amd64 http://google.com/ output.png") It says: wkhtmltoimage-amd64: command not found exec("../../wkhtmltoimage-amd64 http://google.com/ output.png") Didn't work either. Link to comment https://forums.phpfreaks.com/topic/255289-generate-a-screenshot-of-html-css-code/#findComment-1309651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.