Home >Backend Development >PHP Tutorial >PHP CutyCapt生成网页url截图

PHP CutyCapt生成网页url截图

WBOY
WBOYOriginal
2016-06-23 13:56:591029browse

Requirements:


1,需要一个linux系统。

2, X-Server。(在命令行下实现对X-server的模拟,渲染图形进行缓存)-在没有安装X-Server的环境下提供图像渲染)


Agenda:


以ubuntu系统为例:

1, 打开命令行。

2,安装svn,g++,如果以前装过,执行这段命令也没关系,不会报错。

sudo apt-get install subversion libqt4-webkit libqt4-dev g++
3, 安装CutyCapt,基于svn,
svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
4, 上面如果报错,执行
svn co https://svn.code.sf.net/p/cutycapt/code/
5, 打开CutyCapt安装目录
cd cutycapt/CutyCapt
6, 安装CutyCapt,
qmakemake
7, 安装xvfb

sudo apt-get install xvfb

8, 大功告成,测试一下,执行命令

xvfb-run --server-args="-screen 0, 1024x768x24" ./CutyCapt --url=http://www.baidu --out=baidu.png






php代码执行:

1,打开apache的www目录,新建index.php

2,

<?php //你的CutyCapt安装目录                                          你想要的输出目录                             system('xvfb-run /var/www/CutyCapt/CutyCapt --url=http://www.baidu --out=/var/www/git/d2d-ui/src/backend/heatmap/heatmap.jpg',$m);if (!empty($m)) {    //success!}
3.http://127.0.0.1


完!

Statement:
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