I have searched a lot for a proper solution to have websites screenshot with (with and height) and it was not hard until I used different other services on web which was free (limited) and sometimes using google services to solve this issue but I really don’t like to use free services and you know when it’s free there is a limit and it’s not okay and I can’t offered the pricing they have and it was not in my server and this is a problem here.
so I search more until I found a python file opensource project which helped me a lot and it’s actually way easier then using API from free services
it can be easly instal into your ubuntu machin and will be runable with below command
xvfb-run webscreenshot -w 20 -o $pathtosave -v $url
$pathtosave: is the location that screenshot will be saved
$url: is the link of the webpage
it’s done. no it’s not what about php?
now just use exec function of php to do that job
$pathtosave = '/var/www/screenshots/'; $url = 'https://google.com'; exec("xvfb-run webscreenshot -w 20 -o $pathtosave -v $url");
then you can have your screenshot from google.com in /var/www/screenshots/