Taking website screenshot, server-side, on a Linux rented server, free

前端 未结 5 1685
清歌不尽
清歌不尽 2020-12-14 04:08

Ok so, right now I can\'t really afford to pay for any service. I want to be able to take screenshots using my rented server, which is Linux based, and output them on the sc

5条回答
  •  天涯浪人
    2020-12-14 04:52

    PhantomJs is the solution

    if(phantom.state.length === 0){
      phantom.state = '0_home';
      phantom.open('http://www.mini.de');
    }
    else if(phantom.state === '0_home'){
      phantom.viewportSize = {width: 800, height: 600};
      phantom.sleep(2000);
      phantom.render('home.png');
      phantom.exit(0);
    }
    

提交回复
热议问题