【问题标题】:imagemagick pdf is not converting into a imageimagemagick pdf没有转换成图像
【发布时间】:2016-04-25 20:24:17
【问题描述】:
<?php 
class Pdf_to_img extends CI_Controller{
public function converter(){
$this->load->library('image_lib');
$config = array(
    'image_library' => 'imagemagick',
    'library_path' => 'D:\Program Files\ImageMagick-6.9.3-Q16',
    'source_image' => 'theme/assets/pdf/ci.pdf' ,
    'new_image' => 'theme/assets/img/copy.jpg' ,
    'maintain_ratio' => true,
    'width' => 980,
    'quality' => '90%',
   );

   $this->image_lib->initialize( $config );

   if ( $this->image_lib->resize( ) ) {
    $this->image_lib->clear( );
   }
 }
 }
 ?>

朋友们,因为我是 codeigniter 的新手,我在冲浪时将 pdf 文件转换为图像我有这段代码,我已经更改了所有位置,但是在执行时我收到错误为

图片路径不正确。 图像处理失败。请验证您的服务器是否支持所选协议以及您的图片库的路径是否正确。

因此,如果有任何错误或要添加任何代码以进行更改,请更正我的代码

我已经在 D:\Program Files\ImageMagick-6.9.3-Q16

上安装了 ImageMagick

并且 source_image 路径是 D:\wamp\www\login\theme\assets\pdf

新的图片路径是D:\wamp\www\login\theme\assets\img

【问题讨论】:

    标签: php codeigniter imagemagick imagick


    【解决方案1】:

    请确认首先安装了imagickphp 库。然后使用以下命令:

    $imagick = new Imagick();
    $imagick->readImage('mytest.pdf');
    $imagick->writeImage('output.jpg');
    

    【讨论】:

      猜你喜欢
      • 2012-09-05
      • 2011-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-22
      • 1970-01-01
      • 2012-03-31
      • 2016-05-14
      相关资源
      最近更新 更多