CutyCapt is a screenshot tool.
Official website http://cutycapt.sourceforge.net/
My main goal is to save the web page as an image in php, and start installing CutyCapt without much nonsense.
Yum install epel-release
# Dependency installation
Yum install Xvfb
Yum install xorg-x11-fonts *
Yum install qtwebkit-devel qt-devel
# Chinese font
Yum install fonts-chinese
Yum install CutyCapt
# Test use
Xvfb-run -- server-args = "-screen 0, 1920x1080x24" CutyCapt -- url = http://www.phpsong.com --out1_phpsong.jpg
If the error libEGL warning: DRI2: failed to open swrast (search paths/usr/lib64/dri) is returned)
Solution
Yum install mesa-dri-drivers
Problem
1) garbled characters appear during screenshots
2) slow execution speed
3) truncate Baidu and Komatsu's blog and find that the text on the button is not displayed. It should also be garbled.
PS. Chinese garbled characters
Upload the Chinese font in windows to the/usr/share/fonts directory and run the fc-cache command.
Test screenshot
Xvfb-run -- server-args = "-screen 0, 1920x1080x24" CutyCapt -- url = http://www.phpsong.com --out00001.jpg
Xvfb-run -- server-args = "-screen 0, 1920x1080x24" CutyCapt -- url = http://www.baidu.com --out00002.jpg
Xvfb-run -- server-args = "-screen 0, 1920x1080x24" CutyCapt -- url = http://www.163.com --out00003.jpg
Xvfb-run -- server-args = "-screen 0, 1920x1080x24" CutyCapt -- url = http://www.sina.com.cn --out00004.jpg
Example
<? Php
/*
Web screenshot function, IE + CutyCapt must be installed
Url: The webpage to take a screenshot
Out: image storage path
Path: CutyCapt path
Cmd: CutyCapt
For example, http: // Your php path. php? Url = http://www.111cn.net
*/
$ Url = $ _ GET ["url"];
$ Imgname = str_replace ('http: // ', '', $ url );
$ Imgname = str_replace ('https: // ', '', $ imgname );
$ Imgname = str_replace ('.', '-', $ imgname );
$ Out = 'd:/webroot/test/'.w.imgname.'.png ';
$ Path = 'd:/webserver/CutyCapt.exe ';
$ Cmd = "$ path -- url = $ url -- out = $ out ";
Echo $ cmd;
System ($ cmd );
?>