为什么我收到此错误

The path of the filename is correct, but for some reason I'm getting the error below when i run the script .. phpinfo shows me imagick is installed ...and I downloaded ghostscript but I'm not sure if it detects it .. all I did was downloading it to my computer .. is there anything that I'm missing ? I'm confused on how to get ghostscript to work with php

Fatal error: Uncaught exception 'ImagickException' with message 'Can not process empty Imagick object' in C:\xampp\htdocs\tms\test_php.php:7 Stack trace: #0 C:\xampp\htdocs\tms\test_php.php(7): Imagick->setimageresolution(1250, 1250) #1 {main} thrown in C:\xampp\htdocs\tms\test_php.php on line 7

PHP Code:

    //echo phpinfo();
    $filename = dirname(__FILE__).'\_media\4055-Beckman-Lead-App\client\fpo.pdf';
    echo $filename;
    $im = new imagick( $filename, 0777); 
    $im->setImageResolution(1250,1250);
    $im->setImageColorspace(255);
    $im->setCompression(Imagick::COMPRESSION_JPEG);
    $im->setCompressionQuality(100);
    $im->setImageFormat('jpeg');

    $im->writeImage('thumb.jpg');
    $im->clear();
    $im->destroy();

It appears as though the constructor for the Imagick class should only have one parameter passed to it, but you are passing two ($filename, 0777).

Replace

$im = new imagick( $filename, 0777); 

with

$im = new Imagick($filename); 

http://www.php.net/manual/en/imagick.construct.php