1

Want to get an image (JPEG) from $html variable in PHP.

Steps:

  1. Transform my code to a canvas in HTML5
  2. Transform my canvas in image.

I know the steps but I do not know how to code them.

I do not want to use wkhtmltopdf.

Thanks for your help.

PS: Saw that (Website screenshots using PHP) but it's not in HTML5.

--

EDIT: Try to use this but do not work...

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var img=document.body;
ctx.drawImage(img,10,10);
Community
  • 1
  • 1
F__M
  • 1,518
  • 1
  • 19
  • 34
  • I did not work because you cant do that. You need a service on the server that will take screenshots of a webpage and render it for you , like phantomjs , etc .... – mpm Feb 27 '13 at 01:29
  • $html is my PHP value that containing my html code page (from to ). – F__M Feb 27 '13 at 01:31
  • mpm with HTML5 I can without render plugin. (i.e.: html5canvastutorials.com) :) – F__M Feb 27 '13 at 01:33
  • @Francois M well it doesnt work for you obviously since you are asking the question. You cant just with HTML5. – mpm Feb 27 '13 at 01:35
  • Just see this link (http://html2canvas.hertzen.com/examples.html). i ll try this. – F__M Feb 27 '13 at 01:37

0 Answers0