Jump to content

How can I convert html file/string to image??


c815902

Recommended Posts

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

Link to comment
Share on other sites

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 :

 

0814.jpg

 

I really want is below image :

 

0814.PNG

 

Thanks for your kindly help.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.