Imagick停止在xampp

时间:2018-03-08 14:27:02

标签: php openssl imagick php-openssl

使用this链接在Xampp中安装了Imagick。它运作正常,但突然停止了工作。

我之间只做了一件事,尝试在zend 3中配置gmail stmp设置。虽然我不确定但是之后它停止了工作。

这是错误

  

致命错误:未捕获ImagickException:Imagick :: __ construct():SSL   代码1操作失败.OpenSSL错误消息:   错误:14090086:SSL例程:ssl3_get_server_certificate:certificate   在C:\ xampp \ htdocs \ restau \ restau \ public \ image.php:55中验证失败   堆栈跟踪:#0 C:\ xampp \ htdocs \ restau \ restau \ public \ image.php(55):   Imagick-> __ construct('https://storage ...')#1 {main}接下来   ImagickException:无法读取文件   C:\ xampp \ htdocs \ restau \ restau \ public \ image.php:55堆栈跟踪:#0   C:\ XAMPP \ htdocs中\ restau \ restau \公共\ image.php(55):   Imagick-> __ construct('https://storage ...')#1 {main}引入   第55行的C:\ xampp \ htdocs \ restau \ restau \ public \ image.php

line of having error

修改1

关注this链接并更改了

curl.cainfo =“C:\ xampp \ perl \ vendor \ lib \ Mozilla \ CA \ cacert.pem”

openssl.cafile = “C:\ XAMPP \ perl的\厂商\ lib中\ Mozilla的\ CA \ cacert.pem”

这是我现在得到的错误

Fatal error: Uncaught ImagickException: Failed to read the file in C:\xampp\htdocs\restau\restau\public\image.php:55 Stack trace: #0 C:\xampp\htdocs\restau\restau\public\image.php(55): Imagick->__construct('https://storage...') #1 {main} thrown in C:\xampp\htdocs\restau\restau\public\image.php on line 55

下面是没有加载图片的代码,直到几天前它才能正常工作。

<img src="/image.php?filename=https://storage.googleapis.com/xxxxxx/uploads_56ea606ea4685.jpg&amp;width=380&amp;height=255" alt="">

提前致谢!!

1 个答案:

答案 0 :(得分:0)

这就是我解决这个问题的方法。

我替换了这部分代码

if(filter_var($imagePath, FILTER_VALIDATE_URL)) {
    $imagick = new Imagick($imagePath);
} else {
    $imagick = new Imagick(getcwd().$imagePath);
}

用这个

if(filter_var($imagePath, FILTER_VALIDATE_URL)) {
  $tempFile = 'temp/file-'.uniqid().'.jpg';
  copy($imagePath, $tempFile);
  $imagick = new Imagick(getcwd().'/'.$tempFile);
  unlink(getcwd().'/'.$tempFile);
} else {
  $imagick = new Imagick(getcwd().$imagePath);
}