php imagick脚本以错误500结尾

时间:2018-07-17 07:26:01

标签: php iis imagemagick imagick windows-server-2012-r2

我有一个简单的PHP脚本,可将pdf转换为jpg文件:

<?php
error_reporting(E_ALL);

$pdf_file   = 'C:\inetpub\wwwroot\pbdev\10001.pdf';
$save_to    = 'C:\inetpub\wwwroot\pbdev\daten\demo.jpg';

$img = new imagick();

//this must be called before reading the image, otherwise has no effect - "-density {$x_resolution}x{$y_resolution}"
//this is important to give good quality output, otherwise text might be unclear
$img->setResolution(200,200);

//read the pdf
$img->readImage("{$pdf_file}[0]");

//reduce the dimensions - scaling will lead to black color in transparent regions
$img->scaleImage(800,0);

//set new format
$img->setImageFormat('jpg');

// -flatten option, this is necessary for images with transparency, it will produce white background for transparent regions
$img = $img->flattenImages();

//save image file
$img->writeImages($save_to, false);

?>

脚本以错误500结尾

日志文件仅给出以下警告:

[17-Jul-2018 09:21:43 Europe/Berlin] PHP Warning:  Version warning: Imagick was compiled against Image Magick version 1683 but version 26896 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0

0 个答案:

没有答案