php - Phantomjs not creating screenshot -


I was trying to create a web screenshot with phantomjs, but it took the result of an empty image. I'm using Fedora OS. Here's my javascript.

screen.js

  var requires webpage = ('webpage'); Page = webpage Create (); Page.open ('http://google.com'); Page.onLoadFinished = function () {page.render ('googleScreenShot' + '.png'); Phantom.exit ();}  

And here is my PHP code

shot.php

  $ Exec = '/ var / www / html / test / bin / phantomjs /var/www/html/test/screen.js'; $ Escaped_command = escapeshellcmd ($ exec); Executive ($ escaped_command);  

But the image created was empty. FontJungle received permission. Please help me

I'm not sure but it can work, try it

  var requires webpage = ('webpage'); Page = webpage Create (); Page.open ('http://google.com'); Page Open Load = Function () {window.setTimeout (function () {page.render ('googleScreenShot' + '.png'); phantom.exit ();}, 2000); }  

Comments