In LINUX, PHP implements the web page screenshot instance program

Source: Internet
Author: User
Web page screenshots were previously implemented only in asp.net. next I will introduce how to use a plug-in linux to allow php to implement web page screenshots. I hope it will be helpful to you. server: to implement a program, you must use the server program, c... web page screenshots were previously implemented only in asp.net. next I will introduce how to use a plug-in linux to allow php to implement web page screenshots. I hope it will be helpful to you.

Server: For the implementation of the program must rely on the server-side program, http://code.google.com/p/wkhtmltopdf/

You can convert a webpage to a pdf or image. The difference between 32 and 64-bit is that you can find a version suitable for your server.

Installation:The installation process is very simple: extract the package and find a proper path to put it down...

Run:Command line call 1, the code is as follows:

/Servers/app/qtwebkit/wkHtmlToImage phprm.com www.phprm.com.png

The default definition is relatively high, and the image size will be large. it takes some time to generate the image.

The php code is as follows:

Exec ('/servers/app/qtwebkit/wkHtmlToImage phprm.com www.phprm.com.png ');

The code is as follows:

 

Chinese garbled characters:It mainly depends on whether the server supports the Chinese language. if garbled characters appear, simply install a Chinese package. the code is as follows:

Yum install fonts-chinese

Article URL:

Reprint ^ at will, but please attach the tutorial address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.