Solution to Trying to clone an uncloneable object of class Imagic_PHP Tutorial

WBOY
Release: 2016-07-21 15:21:05
Original
862 people have browsed it

After installation under windows, the prompt is:
Fatal error: Trying to clone an uncloneable object of class Imagick in C:wwwhxpdf_to_png.php on line 17

This prompt will appear when using IIS and Apache. After many tests, two solutions were found:

1.php.ini; Enable compatibility mode with Zend Engine 1 (PHP 4.x)
zend.ze1_compatibility_mode = Off

The default is On, changing it to Off will solve the problem.

2. Use imagick::... to call.
That is, $im->setResolution(120, 120); can be rewritten as:
imagick::setResolution(120, 120);


If this kind of error occurs in other extensions, these two methods can generally be used to solve it.

Attached is the program code snippet for converting pdf to png:

Copy the code The code is as follows:

function pdf2png($pdf, $filename, $page=0) {                                                                             
                                                                           file_exists($pdf)) {
                                                                                                                                                                                     🎜> $im-> ;setCompressionQuality(100);
            $im->readImage($pdf . "[" . $page . "]");                             im->writeImage($filename);
   $ im->writeImage($filename);
                                                                                                                   



http://www.bkjia.com/PHPjc/324944.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/324944.html

TechArticle

prompts after installation under windows: Fatal error: Trying to clone an uncloneable object of class Imagick in C:wwwhxpdf_to_png .php on line 17 This prompt will appear when using IIS and Apache. ...

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