SoFunction
Updated on 2025-03-10

php method to implement web page screenshot by executing the CutyCapt command

This article describes the method of php to implement web page screenshot by executing the CutyCapt command. Share it for your reference, as follows:

Exec commands using php

PS. By default, the exec function is disabled. Open to check whether the disabled_function contains this or not. If there is, remove it.

Copy the codeThe code is as follows:
exec('xvfb-run --server-args="-screen 0, 1024x768x24" CutyCapt --url=https:// --out=');

One question in this is my picture only has the first screen, so crop the picture
Copy the codeThe code is as follows:
yum install ImageMagick

Use convert -crop for cropping
Copy the codeThe code is as follows:
convert -crop 1024x768+0+0

Use convert -resize for image scaling
Copy the codeThe code is as follows:
convert -resize 15%x15%

For more information about PHP related content, please check out the topic of this site:Summary of PHP graphics and picture operation skills》、《Introduction to PHP basic syntax》、《Summary of PHP operations and operator usage》、《PHP object-oriented programming tutorial》、《Summary of PHP network programming skills》、《Complete collection of PHP array (Array) operation techniques》、《Summary of usage of php strings》、《PHP+mysql database operation tutorial"and"Summary of common database operation techniques for php

I hope this article will be helpful to everyone's PHP programming.