0

I have a WYSIWYG Editor where a user can enter all the Text, make it bold, italic, change fonts etc.

What i want to do is, convert the HTML entered into WYSIWYG Editor to JPG.

Is it possible ? Any code ?

user580950
  • 3,558
  • 12
  • 49
  • 94
  • 2
    Sounds like you want `wkhtmltoimage` or another website screenshot tool. – mario Apr 06 '11 at 04:49
  • If the HTML is basic, it might be easier to use any of the PHP [image processing](http://www.php.net/manual/en/refs.utilspec.image.php) APIs. But please use PNG and not JPEG. – Steve-o Apr 06 '11 at 05:15
  • I am using an HTML WYSIWYG Editor so cant restrict the HTML from users perscpective. "wkhtmltoimage" is it a PHP library ? – user580950 Apr 06 '11 at 05:50
  • It's an executable which you call from command line. There are PHP scripts to ease running it with the right functionality. – Christian Apr 06 '11 at 06:39
  • possible duplicate of [Is there a way to automatically take a screenshot of a website through a URL?](http://stackoverflow.com/questions/2109173/is-there-a-way-to-automatically-take-a-screenshot-of-a-website-through-a-url) – Pekka Apr 06 '11 at 08:19

2 Answers2

1

Yes it is possible..

You will need to create a php script that will just simply output that HTML nothing else eg. html.php?pageid={Dynamic ID }

Then you will need to download the wkhtmltoimage

After you download it set its path in the environment variables

Afterwards you will simply need to use this code to convert it to a image

 exec("wkhtmltoimage html.php?pageid=323 teset.jpg");

If you have any other queries let me know :)

Kuldeep Singh
  • 451
  • 2
  • 13
-1

Sure, you can integrate SWFUpload into it and pass the image tag inside the editor div.

SWFUpload is good because it is cross-browser. It first chooses Flash, then decides if it needs to fall back to javascript or even a basic form.

Chris Frederick
  • 5,482
  • 3
  • 36
  • 44
Capitaine
  • 1,923
  • 6
  • 27
  • 46