How to use PHP to take screenshots of web pages by executing the CutyCapt command

高洛峰
Release: 2023-03-03 19:20:01
Original
1482 people have browsed it

The example in this article describes how to use PHP to capture web pages by executing the CutyCapt command. Share it with everyone for your reference, the details are as follows:

Use php to execute commands using exec

PS. By default, the exec function is disabled. Open php.ini to check whether disable_function contains this or not. If so, remove it

exec('xvfb-run --server-args="-screen 0, 1024x768x24" CutyCapt --url=http://www.jb51.net --out=2.jpg');
Copy after login

This One problem is that my picture only has the first screen, so I crop the picture

yum install ImageMagick
Copy after login

Use convert -crop to crop

convert -crop 1024x768+0+0 2.jpg 22.jpg
Copy after login

Use convert -resize to zoom the picture

convert -resize 15%x15% 22.jpg 22.jpg
Copy after login

I hope this article will be helpful to everyone in PHP program design .

For more related articles on how to use PHP to realize web page screenshots by executing the CutyCapt command, please pay attention to the PHP Chinese website!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!